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

List:       kde-commits
Subject:    playground/base/plasma/applets/rssnow
From:       Lukas Appelhans <l.appelhans () gmx ! de>
Date:       2008-05-14 22:10:26
Message-ID: 1210803026.255486.13829.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 807859 by lappelhans:

showConfigurationInterface() --> createConfiguratioInterface(KConfigDialog *parent)


 M  +15 -21    news.cpp  
 M  +1 -2      news.h  


--- trunk/playground/base/plasma/applets/rssnow/news.cpp #807858:807859
@@ -33,13 +33,13 @@
 //KDE
 #include <kglobal.h>
 #include <kicon.h>
+#include <kconfigdialog.h>
 
 //Plasma
 #include <plasma/containment.h>
 
 News::News(QObject *parent, const QVariantList &args)
-    : Plasma::Applet(parent, args),
-      m_dialog(0)
+    : Plasma::Applet(parent, args)
 {
     setHasConfigurationInterface(true);
     setBackgroundHints(DefaultBackground);
@@ -110,27 +110,21 @@
     }
 }
 
-void News::showConfigurationInterface()
+void News::createConfigurationInterface(KConfigDialog *parent)
 {
     //TODO: we probably want to disable the add button until there's actually
     //an url in the combobox.
-    if (m_dialog == 0) {
-        m_dialog = new KDialog;
-        m_dialog->setCaption(i18n("Configure News"));
-
-        ui.setupUi(m_dialog->mainWidget());
-        m_dialog->setButtons(KDialog::Ok | KDialog::Cancel | KDialog::Apply);
-        connect(m_dialog, SIGNAL(applyClicked()), this, SLOT(configAccepted()));
-        connect(m_dialog, SIGNAL(okClicked()), this, SLOT(configAccepted()));
-        connect(ui.addFeed, SIGNAL(clicked()), this, SLOT(addFeed()));
-        connect(ui.removeFeed, SIGNAL(clicked()), this, SLOT(removeFeed()));
-        connect(ui.feedList, SIGNAL( itemSelectionChanged ()), this, \
                SLOT(slotItemChanged()));
-        connect(ui.feedComboBox->lineEdit(), SIGNAL( textChanged( const QString& ) \
                ), this, SLOT( slotChangeText(const QString& ) ) );
-        ui.removeFeed->setEnabled( false );
-        KConfig feedsFile(QString("news/feeds"), KConfig::FullConfig, "data");
-        m_defaultFeeds = feedsFile.group("feeds").entryMap();
-        ui.addFeed->setEnabled( false );
-    }
+    QWidget *widget = new QWidget(0);
+    ui.setupUi(widget);
+    connect(parent, SIGNAL(accepted()), this, SLOT(configAccepted()));
+    connect(ui.addFeed, SIGNAL(clicked()), this, SLOT(addFeed()));
+    connect(ui.removeFeed, SIGNAL(clicked()), this, SLOT(removeFeed()));
+    connect(ui.feedList, SIGNAL( itemSelectionChanged ()), this, \
SLOT(slotItemChanged())); +    connect(ui.feedComboBox->lineEdit(), SIGNAL( \
textChanged( const QString& ) ), this, SLOT( slotChangeText(const QString& ) ) ); +   \
ui.removeFeed->setEnabled( false ); +    KConfig feedsFile(QString("news/feeds"), \
KConfig::FullConfig, "data"); +    m_defaultFeeds = \
feedsFile.group("feeds").entryMap(); +    ui.addFeed->setEnabled( false );
     ui.feedComboBox->clear();
     ui.feedList->clear();
     foreach (const QString& name, m_defaultFeeds.keys()) {
@@ -155,7 +149,7 @@
     foreach (QString feed, m_feedlist) {
         ui.feedList->addItem(feed);
     }
-    m_dialog->show();
+    parent->addPage(widget, i18n("Configure News"));
 }
 
 void News::slotChangeText( const QString& text )
--- trunk/playground/base/plasma/applets/rssnow/news.h #807858:807859
@@ -48,7 +48,7 @@
         void init();
 
     public slots:
-        void showConfigurationInterface();
+        void createConfigurationInterface(KConfigDialog *parent);
         void switchItems();
 
     protected:
@@ -80,7 +80,6 @@
 
         QGraphicsLinearLayout  *m_layout;
         Header              *m_header;
-        KDialog             *m_dialog;
         Ui::config          ui;
 
         QMap<QString, QString>    m_defaultFeeds;


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

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