File 08-use-default-database-path.patch of Package kde3-klamav

# Patch from Atomo64.
# Thanks to him.

diff -Nur -x '*.orig' -x '*~' klamav-0.44/src/firstrunwizard.ui klamav-0.44.new/src/firstrunwizard.ui
--- klamav-0.44/src/firstrunwizard.ui	2008-07-06 08:05:42.000000000 -0400
+++ klamav-0.44.new/src/firstrunwizard.ui	2008-07-07 13:13:06.000000000 -0400
@@ -152,50 +152,6 @@
                 </rect>
             </property>
         </spacer>
-        <widget class="QCheckBox">
-            <property name="name">
-                <cstring>CheckForDatabaseUpdates</cstring>
-            </property>
-            <property name="geometry">
-                <rect>
-                    <x>16</x>
-                    <y>300</y>
-                    <width>430</width>
-                    <height>30</height>
-                </rect>
-            </property>
-            <property name="text">
-                <string>Check for &amp;updates to the signature database now.</string>
-            </property>
-            <property name="accel">
-                <string>Alt+U</string>
-            </property>
-            <property name="checked">
-                <bool>true</bool>
-            </property>
-        </widget>
-        <widget class="QCheckBox">
-            <property name="name">
-                <cstring>CheckForClamAVUpdates</cstring>
-            </property>
-            <property name="geometry">
-                <rect>
-                    <x>466</x>
-                    <y>300</y>
-                    <width>340</width>
-                    <height>30</height>
-                </rect>
-            </property>
-            <property name="text">
-                <string>Check for updates &amp;to ClamAV now.</string>
-            </property>
-            <property name="accel">
-                <string>Alt+T</string>
-            </property>
-            <property name="checked">
-                <bool>false</bool>
-            </property>
-        </widget>
         <widget class="QGroupBox">
             <property name="name">
                 <cstring>groupBox1</cstring>
@@ -357,10 +313,55 @@
                 <enum>AtWordBoundary</enum>
             </property>
         </widget>
+        <widget class="QCheckBox">
+            <property name="name">
+                <cstring>CheckForDatabaseUpdates</cstring>
+            </property>
+            <property name="geometry">
+                <rect>
+                    <x>16</x>
+                    <y>300</y>
+                    <width>430</width>
+                    <height>30</height>
+                </rect>
+            </property>
+            <property name="text">
+                <string>Check for &amp;updates to the signature database now.</string>
+            </property>
+            <property name="accel">
+                <string>Alt+U</string>
+            </property>
+            <property name="checked">
+                <bool>false</bool>
+            </property>
+        </widget>
+        <widget class="QCheckBox">
+            <property name="name">
+                <cstring>CheckForClamAVUpdates</cstring>
+            </property>
+            <property name="enabled">
+                <bool>false</bool>
+            </property>
+            <property name="geometry">
+                <rect>
+                    <x>466</x>
+                    <y>300</y>
+                    <width>340</width>
+                    <height>30</height>
+                </rect>
+            </property>
+            <property name="text">
+                <string>Check for updates &amp;to ClamAV now.</string>
+            </property>
+            <property name="accel">
+                <string>Alt+T</string>
+            </property>
+            <property name="checked">
+                <bool>false</bool>
+            </property>
+        </widget>
     </widget>
 </widget>
-<customwidgets>
-</customwidgets>
 <includes>
     <include location="local" impldecl="in implementation">firstrunwizard.ui.h</include>
 </includes>
diff -Nur -x '*.orig' -x '*~' klamav-0.44/src/firstrunwizard.ui.h klamav-0.44.new/src/firstrunwizard.ui.h
--- klamav-0.44/src/firstrunwizard.ui.h	2008-07-06 08:05:42.000000000 -0400
+++ klamav-0.44.new/src/firstrunwizard.ui.h	2008-07-07 13:13:06.000000000 -0400
@@ -33,7 +33,7 @@
     helpButton()->hide();
 
     QString homepath = getenv("HOME");
-    databasepath = homepath + "/.klamav/database";
+    databasepath = "/var/lib/clamav";
     DatabaseLocation->setURL(databasepath);
 
     quarantinepath = homepath + "/.klamav/quarantine";
diff -Nur -x '*.orig' -x '*~' klamav-0.44/src/freshklam.cpp klamav-0.44.new/src/freshklam.cpp
--- klamav-0.44/src/freshklam.cpp	2008-07-07 13:13:05.000000000 -0400
+++ klamav-0.44.new/src/freshklam.cpp	2008-07-07 13:13:06.000000000 -0400
@@ -261,6 +261,11 @@
     if (!(config->readEntry("NoOfUpdates").isEmpty()))
         check_combo->setCurrentText(config->readEntry("NoOfUpdates"));
     check_combo->adjustSize();
+    // Debian patch
+    // If /var/lib/clamav is the signatures directory, disable the update options
+    // because it is more likely the user doesn't have write access to those files
+    if (strcmp(lastDownloadPaths[0].ascii(),"/var/lib/clamav")==0||strcmp(lastDownloadPaths[0].ascii(),"/var/lib/clamav/")==0)
+        check_combo->setEnabled(false);
     //check_combo->setFixedSize(check_combo->size());
     daemon_check_layout->addWidget(check_combo);
 
@@ -276,7 +281,14 @@
     vbox->addWidget(actionbox, 2, 0);
     actionbox->addStretch();
     search_button = actionbox->addButton(i18n("&Update Now"));
-    search_button->setDefault(true);
+
+    // Debian patch
+    // If /var/lib/clamav is the signatures directory, disable the update options
+    // because it is more likely the user doesn't have write access to those files
+    if (strcmp(lastDownloadPaths[0].ascii(),"/var/lib/clamav")==0||strcmp(lastDownloadPaths[0].ascii(),"/var/lib/clamav/")==0) {
+        search_button->setDefault(false);
+        search_button->setEnabled(false);
+    } else search_button->setDefault(true);
     cancel_button = actionbox->addButton(i18n("Cancel"));
     cancel_button->setEnabled(false);
     actionbox->addStretch();
openSUSE Build Service is sponsored by