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

List:       kde-commits
Subject:    KDE/kdepim/libkleo/ui
From:       Marc Mutz <mutz () kde ! org>
Date:       2010-12-07 10:57:23
Message-ID: 20101207105723.EF165AC8A7 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1204447 by mutz:

Kleo::CryptoConfigModule: add a new display type: linearized

 M  +42 -19    cryptoconfigmodule.cpp  
 M  +1 -1      cryptoconfigmodule.h  


--- trunk/KDE/kdepim/libkleo/ui/cryptoconfigmodule.cpp #1204446:1204447
@@ -98,11 +98,17 @@
   return result;
 }
 
-static const KPageView::FaceType determineJanusFace( const Kleo::CryptoConfig * \
                config, Kleo::CryptoConfigModule::Layout layout ) {
-  return num_components_with_options( config ) < 2
-    ? KPageView::Plain
-    : layout == Kleo::CryptoConfigModule::TabbedLayout ? KPageView::Tabbed : \
KPageView::List ; +static KPageView::FaceType determineJanusFace( const \
Kleo::CryptoConfig * config, Kleo::CryptoConfigModule::Layout layout, bool & ok ) { + \
ok = true; +  if ( num_components_with_options( config ) < 2 ) {
+    ok = false;
+    return KPageView::Plain;
 }
+  return
+      layout == CryptoConfigModule::LinearizedLayout ? KPageView::Plain :
+      layout == CryptoConfigModule::TabbedLayout     ? KPageView::Tabbed :
+      /* else */                                       KPageView::List ;
+}
 
 Kleo::CryptoConfigModule::CryptoConfigModule( Kleo::CryptoConfig* config, QWidget * \
parent )  : KPageWidget( parent ), mConfig( config )
@@ -121,16 +127,28 @@
     l->setMargin( 0 );
 
   Kleo::CryptoConfig * const config = mConfig;
-  const KPageView::FaceType type=determineJanusFace( config, layout );
+
+  bool configOK = false;
+  const KPageView::FaceType type = determineJanusFace( config, layout, configOK );
+
   setFaceType(type);
+
   QVBoxLayout * vlay = 0;
   QWidget * vbox = 0;
+
   if ( type == Plain ) {
-    vbox = new QWidget(this);
+    QWidget * w = new QWidget(this);
+    QVBoxLayout * l = new QVBoxLayout( w );
+    l->setSpacing( KDialog::spacingHint() );
+    l->setMargin( 0 );
+    QScrollArea * s = new QScrollArea( w );
+    s->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Preferred );
+    s->setWidgetResizable( true );
+    l->addWidget( s );
+    vbox = new QWidget( s->viewport() );
     vlay = new QVBoxLayout( vbox );
-    vlay->setSpacing( KDialog::spacingHint() );
-    vlay->setMargin( 0 );
-    addPage( vbox, i18n("GpgConf Error") );
+    s->setWidget( vbox );
+    addPage( w, configOK ? QString() : i18n("GpgConf Error") );
   }
 
   const QStringList components = config->componentList();
@@ -140,7 +158,18 @@
     Q_ASSERT( comp );
     if ( comp->groupList().empty() )
       continue;
-    if ( type != Plain ) {
+
+    CryptoConfigComponentGUI * compGUI
+        = new CryptoConfigComponentGUI( this, comp );
+    compGUI->setObjectName( *it );
+    // KJanusWidget doesn't seem to have iterators, so we store a copy...
+    mComponentGUIs.append( compGUI );
+
+    if ( type == Plain ) {
+      QGroupBox * gb = new QGroupBox( comp->description(), vbox );
+      ( new QVBoxLayout( gb ) )->addWidget( compGUI );
+      vlay->addWidget( gb );
+    } else {
       vbox = new QWidget(this);
       vlay = new QVBoxLayout( vbox );
       vlay->setSpacing( KDialog::spacingHint() );
@@ -149,20 +178,13 @@
       if ( type != Tabbed )
           pageItem->setIcon( loadIcon( comp->iconName() ) );
       addPage(pageItem);
-    }
 
-    QScrollArea* scrollArea = type == Tabbed ? new QScrollArea( this ) : new \
ScrollArea( this ); +      QScrollArea* scrollArea = type == Tabbed ? new \
QScrollArea( vbox ) : new ScrollArea( vbox ); +      scrollArea->setSizePolicy( \
QSizePolicy::MinimumExpanding, QSizePolicy::Preferred );  \
scrollArea->setWidgetResizable( true );  
     vlay->addWidget( scrollArea );
-
-    CryptoConfigComponentGUI* compGUI =
-      new CryptoConfigComponentGUI( this, comp, scrollArea );
-    compGUI->setObjectName( *it );
     scrollArea->setWidget( compGUI );
-    scrollArea->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Preferred \
                );
-    // KJanusWidget doesn't seem to have iterators, so we store a copy...
-    mComponentGUIs.append( compGUI );
 
     // Set a nice startup size
     const int deskHeight = QApplication::desktop()->height();
@@ -177,6 +199,7 @@
     if ( type != Tabbed )
         scrollArea->setMinimumHeight( qMin( compGUI->sizeHint().height(), \
dialogHeight ) );  }
+  }
   if ( mComponentGUIs.empty() ) {
       const QString msg = i18n("The gpgconf tool used to provide the information "
                                "for this dialog does not seem to be installed "
--- trunk/KDE/kdepim/libkleo/ui/cryptoconfigmodule.h #1204446:1204447
@@ -57,7 +57,7 @@
   class KLEO_EXPORT CryptoConfigModule : public KPageWidget {
     Q_OBJECT
   public:
-    enum Layout { TabbedLayout, IconListLayout };
+    enum Layout { TabbedLayout, IconListLayout, LinearizedLayout };
     explicit CryptoConfigModule( Kleo::CryptoConfig* config, QWidget * parent=0 );
     explicit CryptoConfigModule( Kleo::CryptoConfig* config, Layout layout, QWidget \
* parent=0 );  


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

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