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

List:       kde-commits
Subject:    branches/KDE/4.5/kdenetwork/krdc
From:       Urs Wolfer <uwolfer () kde ! org>
Date:       2010-07-17 13:12:42
Message-ID: 20100717131242.DEB1EAC76A () svn ! kde ! org
[Download RAW message or body]

SVN commit 1151010 by uwolfer:

Backport to 4.5 branch:
SVN commit 1151008 by uwolfer:

Set proper minimum size of host preferences dialog. It looks like there is a \
workaround required im some cases. (+minor beautifications)

CCBUG:244539

 M  +1 -1      config/hostpreferenceslist.cpp  
 M  +14 -9     core/hostpreferences.cpp  
 M  +2 -2      core/hostpreferences.h  
 M  +3 -4      mainwindow.cpp  


--- branches/KDE/4.5/kdenetwork/krdc/config/hostpreferenceslist.cpp #1151009:1151010
@@ -111,7 +111,7 @@
         }
 
         if (prefs) {
-            prefs->showDialog();
+            prefs->showDialog(this);
             delete prefs;
         } else {
             KMessageBox::error(this,
--- branches/KDE/4.5/kdenetwork/krdc/core/hostpreferences.cpp #1151009:1151010
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2007 Urs Wolfer <uwolfer @ kde.org>
+** Copyright (C) 2007 - 2010 Urs Wolfer <uwolfer @ kde.org>
 **
 ** This file is part of KDE.
 **
@@ -156,31 +156,31 @@
     m_configGroup.writeEntry("viewOnly", view);
 }
     
-bool HostPreferences::showDialogIfNeeded()
+bool HostPreferences::showDialogIfNeeded(QWidget *parent)
 {
     if (hostConfigured()) {
         if (showConfigAgain()) {
             kDebug(5010) << "Show config dialog again";
-            return showDialog();
+            return showDialog(parent);
         } else
             return true; // no changes, no need to save
     } else {
         kDebug(5010) << "No config found, create new";
         if (Settings::showPreferencesForNewConnections())
-            return showDialog();
+            return showDialog(parent);
         else
             return true;
     }
 }
 
 
-bool HostPreferences::showDialog()
+bool HostPreferences::showDialog(QWidget *parent)
 {
     // Prepare dialog
-    KDialog *dialog = new KDialog;
+    KDialog *dialog = new KDialog(parent);
     dialog->setCaption(i18n("Host Configuration"));
 
-    QWidget *mainWidget = new QWidget(dialog);
+    QWidget *mainWidget = dialog->mainWidget();
     QVBoxLayout *layout = new QVBoxLayout(mainWidget);
 
     KTitleWidget *titleWidget = new KTitleWidget(dialog);
@@ -212,9 +212,14 @@
     layout->addWidget(showAgainCheckBox);
     layout->addWidget(walletSupportCheckBox);
     layout->addStretch(1);
-    mainWidget->setLayout(layout);
 
-    dialog->setMainWidget(mainWidget);
+    // WORKAROUND: it seems that KDialog does not set the minimum size properly in \
some cases. +    // see for example issue #244539. also it looks like KTitleWidget \
returns a too small size hint when a comment is shown. +    QSize minimumSize = \
dialog->sizeHint(); +    if (m_connected) {
+        minimumSize += QSize(0, 50);
+    }
+    dialog->setMinimumSize(minimumSize);
     
     // Show dialog
     if (dialog->exec() == KDialog::Accepted) {
--- branches/KDE/4.5/kdenetwork/krdc/core/hostpreferences.h #1151009:1151010
@@ -79,10 +79,10 @@
      * check "show this dialog again for this host".
      * Returns true if user pressed ok. 
      */
-    bool showDialogIfNeeded();
+    bool showDialogIfNeeded(QWidget *parent);
     
     /** Show the configuration dialog */
-    bool showDialog();
+    bool showDialog(QWidget *parent);
 
     /** If @p connected is true, a message is shown that settings might only apply \
after a reconnect. */  void setShownWhileConnected(bool connected);
--- branches/KDE/4.5/kdenetwork/krdc/mainwindow.cpp #1151009:1151010
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2007 - 2009 Urs Wolfer <uwolfer @ kde.org>
+** Copyright (C) 2007 - 2010 Urs Wolfer <uwolfer @ kde.org>
 ** Copyright (C) 2009 Tony Murray <murraytony @ gmail.com>
 **
 ** This file is part of KDE.
@@ -322,7 +322,7 @@
 
     // Configure the view
     HostPreferences* prefs = view->hostPreferences();
-    if (! prefs->showDialogIfNeeded()) {
+    if (! prefs->showDialogIfNeeded(this)) {
         delete view;
         return;
     }
@@ -645,8 +645,7 @@
 
     if (prefs) {
         prefs->setShownWhileConnected(true);
-        prefs->showDialog();
-        delete prefs;
+        prefs->showDialog(this);
     } else {
         KMessageBox::error(this,
                            i18n("The selected host cannot be handled."),


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

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