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

List:       kde-commits
Subject:    [kdepim] pimcommon/texttospeech: Save/load dialog size
From:       Montel Laurent <montel () kde ! org>
Date:       2014-10-31 22:09:18
Message-ID: E1XkKNi-000390-SR () scm ! kde ! org
[Download RAW message or body]

Git commit 800f187cab5f6c860914ba784535ed5f9416b92f by Montel Laurent.
Committed on 31/10/2014 at 22:08.
Pushed by mlaurent into branch 'master'.

Save/load dialog size

M  +19   -0    pimcommon/texttospeech/texttospeechconfigdialog.cpp
M  +2    -0    pimcommon/texttospeech/texttospeechconfigdialog.h
M  +0    -1    pimcommon/texttospeech/texttospeechinterface.cpp

http://commits.kde.org/kdepim/800f187cab5f6c860914ba784535ed5f9416b92f

diff --git a/pimcommon/texttospeech/texttospeechconfigdialog.cpp \
b/pimcommon/texttospeech/texttospeechconfigdialog.cpp index 9fed35c..747e8e9 100644
--- a/pimcommon/texttospeech/texttospeechconfigdialog.cpp
+++ b/pimcommon/texttospeech/texttospeechconfigdialog.cpp
@@ -22,6 +22,8 @@
 #include <QVBoxLayout>
 #include <QDialogButtonBox>
 #include <QPushButton>
+#include <kconfiggroup.h>
+#include <KSharedConfig>
 
 using namespace PimCommon;
 
@@ -41,13 +43,30 @@ TextToSpeechConfigDialog::TextToSpeechConfigDialog(QWidget \
                *parent)
     connect(buttonBox, &QDialogButtonBox::rejected, this, \
&TextToSpeechConfigDialog::reject);  mainLayout->addWidget(buttonBox);
     mTextToSpeechConfigWidget->readConfig();
+    readConfig();
 }
 
 TextToSpeechConfigDialog::~TextToSpeechConfigDialog()
 {
+    writeConfig();
+}
+
+void TextToSpeechConfigDialog::readConfig()
+{
+    KConfigGroup group(KSharedConfig::openConfig(), "TextToSpeechConfigDialog");
+    const QSize sizeDialog = group.readEntry("Size", QSize(600, 400));
+    if (sizeDialog.isValid()) {
+        resize(sizeDialog);
+    }
+}
 
+void TextToSpeechConfigDialog::writeConfig()
+{
+    KConfigGroup group(KSharedConfig::openConfig(), "TextToSpeechConfigDialog");
+    group.writeEntry("Size", size());
 }
 
+
 void TextToSpeechConfigDialog::slotAccepted()
 {
     mTextToSpeechConfigWidget->writeConfig();
diff --git a/pimcommon/texttospeech/texttospeechconfigdialog.h \
b/pimcommon/texttospeech/texttospeechconfigdialog.h index abe6d7c..621c9cd 100644
--- a/pimcommon/texttospeech/texttospeechconfigdialog.h
+++ b/pimcommon/texttospeech/texttospeechconfigdialog.h
@@ -33,6 +33,8 @@ private Q_SLOTS:
     void slotAccepted();
 
 private:
+    void readConfig();
+    void writeConfig();
     PimCommon::TextToSpeechConfigWidget *mTextToSpeechConfigWidget;
 };
 }
diff --git a/pimcommon/texttospeech/texttospeechinterface.cpp \
b/pimcommon/texttospeech/texttospeechinterface.cpp index f8ea34a..cbceb70 100644
--- a/pimcommon/texttospeech/texttospeechinterface.cpp
+++ b/pimcommon/texttospeech/texttospeechinterface.cpp
@@ -60,7 +60,6 @@ void TextToSpeechInterface::stateChanged(TextToSpeechWidget::State \
state)  switch (state) {
     case TextToSpeechWidget::Stop:
         PimCommon::TextToSpeech::self()->stop();
-        //TODO hide widget
         break;
     case TextToSpeechWidget::Play:
         PimCommon::TextToSpeech::self()->resume();


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

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