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

List:       kde-commits
Subject:    playground/base/plasma/applets/leavenote
From:       Christian Weilbach <christian () whiletaker ! homeip ! net>
Date:       2008-08-14 2:15:50
Message-ID: 1218680150.310387.16472.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 846746 by weilbach:

Added the parts to really save and load the config.


 M  +18 -5     plasma-leavenote.cpp  


--- trunk/playground/base/plasma/applets/leavenote/plasma-leavenote.cpp #846745:846746
@@ -63,7 +63,12 @@
 
 void LeaveNote::init()
 {
+   /* do config stuff */
    setHasConfigurationInterface(true);
+   KConfigGroup cg = config();
+   mUseKNotes = cg.readEntry("useKNotes", true);
+   mUseNotification = cg.readEntry("useNotification", true);
+
    /* start the simplemessagedaemon to keep track of the messages
     * even after the applet has vanished (screen unlock) */
    QProcess smd;
@@ -123,23 +128,31 @@
 }
 
 void LeaveNote::createConfigurationInterface(KConfigDialog *dialog)
-{ /* Thanks: Luna - WindowsUninstall, jackrabbit, aseigo */
+{
     QWidget *widget = new QWidget();
     ui.setupUi(widget);
-/* from example in http://api.kde.org/4.x-api/kdelibs-apidocs/kdeui/html/classKDialog.html */
     dialog->setMainWidget( widget );
+
+    KConfigGroup cg = config();
+    ui.useKNotesCheckBox->setChecked(cg.readEntry("useKNotes", true));
+    ui.useNotificationCheckBox->setChecked(cg.readEntry("useNotification", true));
+
     dialog->setButtons(KDialog::Ok | KDialog::Cancel ); // | KDialog::Apply
     connect(dialog, SIGNAL(applyClicked()), this, SLOT(configAccepted()));
     connect(dialog, SIGNAL(okClicked()), this, SLOT(configAccepted()));
 
-   dialog->addPage(widget, dialog->windowTitle(), icon());
+    dialog->addPage(widget, dialog->windowTitle(), icon());
 }
 
 
 void LeaveNote::configAccepted()
 {
-   mUseKNotes = ui.useKNotesCheckBox->isChecked();
-   mUseNotification = ui.useNotificationCheckBox->isChecked();
+    mUseKNotes = ui.useKNotesCheckBox->isChecked();
+    mUseNotification = ui.useNotificationCheckBox->isChecked();
+
+    KConfigGroup cg = config();
+    cg.writeEntry("useKNotes", ui.useKNotesCheckBox->isChecked());
+    cg.writeEntry("useNotification", ui.useNotificationCheckBox->isChecked());
 }
 
 void LeaveNote::slotSend()
[prev in list] [next in list] [prev in thread] [next in thread] 

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