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

List:       kde-core-devel
Subject:    [patch / string change] make kmail's account dialog fit on the screen.
From:       Scott Wheeler <wheeler () kde ! org>
Date:       2008-05-23 14:28:11
Message-ID: 200805231628.11522.wheeler () kde ! org
[Download RAW message or body]

The current KMail IMAP account dialog is too big to fit on my laptop's 13" 
screen.  This patch splits the options out into two columns.  It shortens one 
string (to make it fit in the column) and moves the explanatory note to a 
What's This box.  I consider this fairly important as otherwise you can't see 
the bottom couple of options or the ok / cancel buttons.  Any objections to 
committing?

-Scott

["because-seeing-the-ok-button-is-cool.diff" (text/x-patch)]

Index: accountdialog.cpp
===================================================================
--- accountdialog.cpp	(revision 811534)
+++ accountdialog.cpp	(working copy)
@@ -794,7 +794,6 @@
   connect(KGlobalSettings::self(),SIGNAL(kdisplayFontChanged()),SLOT(slotFontChanged()));
  }
 
-
 void AccountDialog::makeImapAccountPage( bool connected )
 {
   QWidget *page = new QWidget( this );
@@ -941,6 +940,15 @@
   grid->addWidget( listbox, row, 1 );
 
   ++row;
+
+  QGridLayout* checkBoxGrid = new QGridLayout;
+
+  checkBoxGrid->setColumnStretch( 0, 1 );
+  checkBoxGrid->setColumnStretch( 1, 1 );
+
+  grid->addLayout( checkBoxGrid, row, 0, 1, 3 );
+  int checkBoxCount = 0;
+
   mImap.storePasswordCheck =
     new QCheckBox( i18n("Sto&re IMAP password"), page1 );
   mImap.storePasswordCheck->setWhatsThis(
@@ -953,88 +961,83 @@
                    "obfuscated format, but should not be "
                    "considered secure from decryption efforts "
                    "if access to the configuration file is obtained.") );
-  grid->addWidget( mImap.storePasswordCheck, row, 0, 1, 2 );
+  addCheckBox( checkBoxGrid, mImap.storePasswordCheck, &checkBoxCount );
 
   if( !connected ) {
-    ++row;
     mImap.autoExpungeCheck =
-      new QCheckBox( i18n("Automaticall&y compact folders (expunges deleted \
                messages)"), page1);
-    grid->addWidget( mImap.autoExpungeCheck, row, 0, 1, 2 );
+      new QCheckBox( i18n("Automaticall&y compact folders"), page1);
+    mImap.autoExpungeCheck->setWhatsThis(i18n("Activate this to automatically "
+                                              "expunge deleted messages."));
+    addCheckBox( checkBoxGrid, mImap.autoExpungeCheck, &checkBoxCount );
   }
 
-  ++row;
   mImap.hiddenFoldersCheck = new QCheckBox( i18n("Sho&w hidden folders"), page1);
-  grid->addWidget( mImap.hiddenFoldersCheck, row, 0, 1, 2 );
+  addCheckBox( checkBoxGrid, mImap.hiddenFoldersCheck, &checkBoxCount );
 
 
-  ++row;
   mImap.subscribedFoldersCheck = new QCheckBox(
     i18n("Show only s&ubscribed folders"), page1);
-  grid->addWidget( mImap.subscribedFoldersCheck, row, 0, 1, 2 );
+  addCheckBox( checkBoxGrid, mImap.subscribedFoldersCheck, &checkBoxCount );
 
-  ++row;
   mImap.locallySubscribedFoldersCheck = new QCheckBox(
     i18n("Show only &locally subscribed folders"), page1);
-  grid->addWidget( mImap.locallySubscribedFoldersCheck, row, 0, 1, 2 );
+  addCheckBox( checkBoxGrid, mImap.locallySubscribedFoldersCheck, &checkBoxCount );
 
   if ( !connected ) {
     // not implemented for disconnected yet
-    ++row;
     mImap.loadOnDemandCheck = new QCheckBox(
         i18n("Load attach&ments on demand"), page1);
     mImap.loadOnDemandCheck->setWhatsThis(
         i18n("Activate this to load attachments not automatically when you select \
the email but only when you click on the attachment. This way also big emails are \
                shown instantly.") );
-    grid->addWidget( mImap.loadOnDemandCheck, row, 0, 1, 2 );
+    addCheckBox( checkBoxGrid, mImap.loadOnDemandCheck, &checkBoxCount );
   }
 
   if ( !connected ) {
     // not implemented for disconnected yet
-    ++row;
     mImap.listOnlyOpenCheck = new QCheckBox(
         i18n("List only open folders"), page1);
     mImap.listOnlyOpenCheck->setWhatsThis(
         i18n("Only folders that are open (expanded) in the folder tree are checked \
                for subfolders. Use this if there are many folders on the server.") \
                );
-    grid->addWidget( mImap.listOnlyOpenCheck, row, 0, 1, 2 );
+    addCheckBox( checkBoxGrid, mImap.listOnlyOpenCheck, &checkBoxCount );
   }
 
-  ++row;
   mImap.includeInCheck =
     new QCheckBox( i18n("Include in manual mail chec&k"), page1 );
-  grid->addWidget( mImap.includeInCheck, row, 0, 1, 2 );
+  addCheckBox( checkBoxGrid, mImap.includeInCheck, &checkBoxCount );
 
-  ++row;
   mImap.intervalCheck =
     new QCheckBox( i18n("Enable &interval mail checking"), page1 );
-  grid->addWidget( mImap.intervalCheck, row, 0, 1, 3 );
+  addCheckBox( checkBoxGrid, mImap.intervalCheck, &checkBoxCount );
   connect( mImap.intervalCheck, SIGNAL(toggled(bool)),
            this, SLOT(slotEnableImapInterval(bool)) );
-  ++row;
+
   mImap.intervalLabel = new QLabel( i18n("Check inter&val:"), page1 );
-  grid->addWidget( mImap.intervalLabel, row, 0 );
+  grid->addWidget( mImap.intervalLabel, ++row, 0 );
+
   mImap.intervalSpin = new KIntNumInput( page1 );
   mImap.intervalSpin->setRange( GlobalSettings::minimumCheckInterval(), 60, 1 );
   mImap.intervalSpin->setSliderEnabled( false );
   mImap.intervalSpin->setValue( 1 );
   mImap.intervalSpin->setSuffix( i18n( " min" ) );
   mImap.intervalLabel->setBuddy( mImap.intervalSpin );
-  grid->addWidget( mImap.intervalSpin, row, 1 );
+  grid->addWidget( mImap.intervalSpin, ++row, 1 );
 
-  ++row;
   label = new QLabel( i18n("&Trash folder:"), page1 );
   grid->addWidget( label, row, 0 );
   mImap.trashCombo = new FolderRequester( page1,
       kmkernel->getKMMainWidget()->folderTree() );
   mImap.trashCombo->setShowOutbox( false );
   label->setBuddy( mImap.trashCombo );
-  grid->addWidget( mImap.trashCombo, row, 1 );
+  grid->addWidget( mImap.trashCombo, ++row, 1 );
 
-  ++row;
   mImap.useDefaultIdentityCheck = new QCheckBox( i18n("Use default identity"), page \
);  connect( mImap.useDefaultIdentityCheck, SIGNAL( toggled(bool) ),
-           this, SLOT( slotIdentityCheckboxChanged() ) );
-  grid->addWidget( mImap.useDefaultIdentityCheck, row, 0 );
+           this, SLOT( slotIdentityCheckBoxChanged() ) );
 
+  addCheckBox( checkBoxGrid, mImap.useDefaultIdentityCheck, &checkBoxCount );
+
   ++row;
+
   mImap.identityLabel = new QLabel( i18n("Identity:"), page1 );
   grid->addWidget( mImap.identityLabel, row, 0 );
   mImap.identityCombo = new \
KPIMIdentities::IdentityCombo(kmkernel->identityManager(), page1 ); @@ -2112,6 \
+2115,16 @@  return myList.join(",");
 }
 
+void AccountDialog::addCheckBox( QGridLayout* layout, QCheckBox* widget, int* count)
+{
+  int row = *count / 2;
+  int column = *count % 2;
+
+  ++*count;
+
+  layout->addWidget( widget, row, column );
+}
+
 void AccountDialog::initAccountForConnect()
 {
   KAccount::Type type = mAccount->type();
Index: accountdialog.h
===================================================================
--- accountdialog.h	(revision 811534)
+++ accountdialog.h	(working copy)
@@ -239,6 +239,7 @@
     void enableImapAuthMethods();
     void initAccountForConnect();
     const QString namespaceListToString( const QStringList& list );
+    void addCheckBox( QGridLayout* layout, QCheckBox* widget, int* count );
 
   private:
     LocalWidgets mLocal;



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

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