[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kmail-devel
Subject:    Re: PATCH: Checking for KAddressBook
From:       Cornelius Schumacher <schumacher () kde ! org>
Date:       2002-05-28 21:25:47
[Download RAW message or body]

On Sunday 26 May 2002 22:14, Michael Häckel wrote:
> On Thursday 23 May 2002 23:36, Cornelius Schumacher wrote:
> > The attached patch checks for the existence of KAddressBook. If it
> > can't be found a warning is shown and the KAddressBook dependent
> > actions are disabled.
>
> I think this is not a good solution. The user is now told that he is
> missing an addressbook even before KMail starts at all, even if he is
> not interesed in an addressbook but just wants to use KMail for the
> first time.

The message is only shown, when KAddressBook is not installed. This will 
probably only concern a small number of users. If you think it is a 
problem that the mesaage is shown before the main window is shown we 
could also delay the message until the main window is there, but I 
don't know if that is worth the effort.

> I think displaying the addressbook actions always is and telling the
> user about the problem when he actually tries to start the
> addressbook is much better in this case.

But that means, that there can be actions in KMail which don't do 
anything. If the user intentionally did not install KAddressBook the 
menu items are still there, but only show the error message. Isn't it 
better to disable the actions in this case? Otherwise we would have 
this unsatisfying "shareware feeling".

I have attached a patch which does it in the way you suggested. 
Personally I would prefer the other solution.

-- 
Cornelius Schumacher <schumacher@kde.org>
["kaddressbook2.patch" (text/x-diff)]

? kaddressbook.patch
? kaddressbook2.patch
Index: kmaddrbook.cpp
===================================================================
RCS file: /home/kde/kdenetwork/kmail/kmaddrbook.cpp,v
retrieving revision 1.52
diff -u -3 -d -p -r1.52 kmaddrbook.cpp
--- kmaddrbook.cpp	2002/05/14 23:53:43	1.52
+++ kmaddrbook.cpp	2002/05/28 21:15:17
@@ -166,7 +166,9 @@ void KMAddrBookExternal::openEmail( cons
   QString address = addr;
   address.replace( QRegExp("\""), "" );
   if (useKAddressbook()) {
-    KRun::runCommand( "kaddressbook -a \"" + address + "\"" );
+    if ( checkForAddressBook() ) {
+      KRun::runCommand( "kaddressbook -a \"" + address + "\"" );
+    }
     return;
   }
 
@@ -217,7 +219,9 @@ void KMAddrBookExternal::launch(QWidget 
 // file directly, as they aren't used anywhere else.
 // It might also be better to write a string for identifying the addressbook
 // instead of a number as it is done now.
+  if ( checkForAddressBook() ) {
     KRun::runCommand("kaddressbook");
+  }
 #if 0
   if ( useKab() ) {
     KRun::runCommand("kab");
@@ -243,6 +247,18 @@ bool KMAddrBookExternal::useKAddressbook
   KConfigGroupSaver saver(config, "General");
   int ab = config->readNumEntry("addressbook", 1);
   return (ab == 1);
+}
+
+bool KMAddrBookExternal::checkForAddressBook()
+{
+  if ( KStandardDirs::findExe( "kaddressbook" ).isEmpty() ) {
+    KMessageBox::information( 0,
+        i18n("No external address book application found. You might want to "
+             "install KAddressBook from the kdepim module.") );
+    return false;
+  } else {
+    return true;
+  }
 }
 
 #if KDE_VERSION < 305
Index: kmaddrbook.h
===================================================================
RCS file: /home/kde/kdenetwork/kmail/kmaddrbook.h,v
retrieving revision 1.15
diff -u -3 -d -p -r1.15 kmaddrbook.h
--- kmaddrbook.h	2002/05/14 23:53:43	1.15
+++ kmaddrbook.h	2002/05/28 21:15:17
@@ -23,6 +23,7 @@ public:
   static void launch(QWidget *parent);
   static bool useKab();
   static bool useKAddressbook();
+  static bool checkForAddressBook();
 
 #if KDE_VERSION < 305
 private:

_______________________________________________
KMail Developers mailing list
kmail@mail.kde.org
http://mail.kde.org/mailman/listinfo/kmail

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic