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

List:       kde-commits
Subject:    branches/kdepim/enterprise/kdepim/certmanager/lib/ui
From:       Marc Mutz <mutz () kde ! org>
Date:       2008-11-24 13:44:31
Message-ID: 1227534271.225179.29859.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 888446 by mutz:

Output an error message if there were no components with non-zero number of options in them.
Fixes kolab/issue1950 on the kleo side.

 M  +25 -1     cryptoconfigmodule.cpp  


--- branches/kdepim/enterprise/kdepim/certmanager/lib/ui/cryptoconfigmodule.cpp #888445:888446
@@ -62,8 +62,20 @@
     ->loadIcon( s.replace( QRegExp( "[^a-zA-Z0-9_]" ), "_" ), KIcon::NoGroup, KIcon::SizeMedium );
 }
 
+static unsigned int num_components_with_options( const Kleo::CryptoConfig * config ) {
+  if ( !config )
+    return 0;
+  const QStringList components = config->componentList();
+  unsigned int result = 0;
+  for ( QStringList::const_iterator it = components.begin() ; it != components.end() ; ++it )
+    if ( const Kleo::CryptoConfigComponent * const comp = config->component( *it ) )
+      if ( !comp->groupList().empty() )
+        ++result;
+  return result;
+}
+
 static const KJanusWidget::Face determineJanusFace( const Kleo::CryptoConfig * config ) {
-  return config && config->componentList().size() < 2
+  return num_components_with_options( config ) < 2
     ? KJanusWidget::Plain
     : KJanusWidget::IconList ;
 }
@@ -115,6 +127,18 @@
                                 + scrollView->style().pixelMetric(QStyle::PM_ScrollBarExtent),
                                 QMIN( compGUI->sizeHint().height(), dialogHeight ) );
   }
+  if ( mComponentGUIs.empty() ) {
+      Q_ASSERT( face() == Plain );
+      const QString msg = i18n("The gpgconf tool used to provide the information "
+                               "for this dialog does not seem to be installed "
+                               "properly. It did not return any components. "
+                               "Try running \"%1\" on the command line for more "
+                               "information.")
+          .arg( components.empty() ? "gpgconf --list-components" : "gpgconf --list-options gpg" );
+      QLabel * label = new QLabel( msg, vbox );
+      label->setAlignment( Qt::WordBreak );
+      label->setMinimumHeight( fontMetrics().lineSpacing() * 5 );
+  }
 }
 
 void Kleo::CryptoConfigModule::save()
[prev in list] [next in list] [prev in thread] [next in thread] 

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