[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/KDE/3.5/kdepim/certmanager/lib/ui
From: David Faure <faure () kde ! org>
Date: 2007-04-26 21:13:49
Message-ID: 1177622029.226754.26731.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 658363 by dfaure:
Add scrollbar so that the dialog doesn't become too big when gpgconf gives us many \
options to configure. Aegypten issue #370.
M +26 -2 cryptoconfigmodule.cpp
--- branches/KDE/3.5/kdepim/certmanager/lib/ui/cryptoconfigmodule.cpp #658362:658363
@@ -52,10 +52,12 @@
#include <qhbox.h>
#include <qpushbutton.h>
#include <qregexp.h>
+#include <qstyle.h>
+#include <qapplication.h>
using namespace Kleo;
-inline QPixmap loadIcon( QString s ) {
+static inline QPixmap loadIcon( QString s ) {
return KGlobal::instance()->iconLoader()
->loadIcon( s.replace( QRegExp( "[^a-zA-Z0-9_]" ), "_" ), KIcon::NoGroup, \
KIcon::SizeMedium ); }
@@ -86,10 +88,32 @@
if ( face() != Plain ) {
vbox = addVBoxPage( comp->description(), QString::null, loadIcon( \
comp->iconName() ) ); }
+
+ QScrollView * scrollView = new QScrollView( vbox );
+ scrollView->setHScrollBarMode( QScrollView::AlwaysOff );
+ scrollView->setResizePolicy( QScrollView::AutoOneFit );
+ QVBox* boxInScrollView = new QVBox( scrollView->viewport() );
+ boxInScrollView->setMargin( KDialog::marginHint() );
+ scrollView->addChild( boxInScrollView );
+
CryptoConfigComponentGUI* compGUI =
- new CryptoConfigComponentGUI( this, comp, vbox, (*it).local8Bit() );
+ new CryptoConfigComponentGUI( this, comp, boxInScrollView, (*it).local8Bit() \
); // 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();
+ int dialogHeight;
+ if (deskHeight > 1000) // very big desktop ?
+ dialogHeight = 800;
+ else if (deskHeight > 650) // big desktop ?
+ dialogHeight = 500;
+ else // small (800x600, 640x480) desktop
+ dialogHeight = 400;
+ QSize sz = scrollView->sizeHint();
+ scrollView->setMinimumSize( sz.width()
+ + \
scrollView->style().pixelMetric(QStyle::PM_ScrollBarExtent), + \
QMIN( compGUI->sizeHint().height(), dialogHeight ) ); }
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic