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

List:       kde-commits
Subject:    [kxstitch] src: Save the size of dialogs when changed by the user
From:       Steve Allewell <steve.allewell () gmail ! com>
Date:       2015-12-15 22:46:20
Message-ID: E1a8yMO-000637-9y () scm ! kde ! org
[Download RAW message or body]

Git commit 5da96c11c5cfa9d88e45393ab377a43ecdb7ba3d by Steve Allewell.
Committed on 15/12/2015 at 22:45.
Pushed by sallewell into branch 'master'.

Save the size of dialogs when changed by the user

M  +23   -0    src/CalibrateFlossDlg.cpp
M  +6    -0    src/CalibrateFlossDlg.h
M  +20   -1    src/ExtendPatternDlg.cpp
M  +8    -0    src/ExtendPatternDlg.h
M  +18   -0    src/FilePropertiesDlg.cpp
M  +6    -0    src/FilePropertiesDlg.h
M  +18   -0    src/ImageElementDlg.cpp
M  +6    -0    src/ImageElementDlg.h
M  +18   -0    src/ImportImageDlg.cpp
M  +5    -1    src/ImportImageDlg.h
M  +18   -0    src/KeyElementDlg.cpp
M  +6    -0    src/KeyElementDlg.h
M  +20   -0    src/LibraryFilePathsDlg.cpp
M  +8    -0    src/LibraryFilePathsDlg.h
M  +18   -0    src/LibraryManagerDlg.cpp
M  +5    -1    src/LibraryManagerDlg.h
M  +20   -0    src/LibraryPatternPropertiesDlg.cpp
M  +8    -0    src/LibraryPatternPropertiesDlg.h
M  +20   -0    src/NewFlossDlg.cpp
M  +6    -1    src/NewFlossDlg.h
M  +20   -0    src/PagePropertiesDlg.cpp
M  +6    -0    src/PagePropertiesDlg.h
M  +18   -0    src/PaletteManagerDlg.cpp
M  +6    -0    src/PaletteManagerDlg.h
M  +18   -0    src/PatternElementDlg.cpp
M  +6    -0    src/PatternElementDlg.h
M  +13   -0    src/PrintSetupDlg.cpp
M  +3    -1    src/PrintSetupDlg.h
M  +28   -0    src/SymbolSelectorDlg.cpp
M  +6    -0    src/SymbolSelectorDlg.h
M  +18   -0    src/TextElementDlg.cpp
M  +6    -0    src/TextElementDlg.h
M  +18   -0    src/TextToolDlg.cpp
M  +8    -0    src/TextToolDlg.h

http://commits.kde.org/kxstitch/5da96c11c5cfa9d88e45393ab377a43ecdb7ba3d

diff --git a/src/CalibrateFlossDlg.cpp b/src/CalibrateFlossDlg.cpp
index e9765d0..6303950 100644
--- a/src/CalibrateFlossDlg.cpp
+++ b/src/CalibrateFlossDlg.cpp
@@ -11,8 +11,13 @@
 
 #include "CalibrateFlossDlg.h"
 
+#include <QHideEvent>
+#include <QShowEvent>
+
+#include <KConfigGroup>
 #include <KHelpClient>
 #include <KLocalizedString>
+#include <KSharedConfig>
 
 #include "Floss.h"
 #include "FlossScheme.h"
@@ -39,6 +44,24 @@ CalibrateFlossDlg::~CalibrateFlossDlg()
 }
 
 
+void CalibrateFlossDlg::hideEvent(QHideEvent *event)
+{
+    KConfigGroup(KSharedConfig::openConfig(), \
QStringLiteral("DialogSizes")).writeEntry(QStringLiteral("CalibrateFlossDlg"), \
size()); +
+    QDialog::hideEvent(event);
+}
+
+
+void CalibrateFlossDlg::showEvent(QShowEvent *event)
+{
+    QDialog::showEvent(event);
+
+    if (KConfigGroup(KSharedConfig::openConfig(), \
QStringLiteral("DialogSizes")).hasKey(QStringLiteral("CalibrateFlossDlg"))) { +       \
resize(KConfigGroup(KSharedConfig::openConfig(), \
QStringLiteral("DialogSizes")).readEntry(QStringLiteral("CalibrateFlossDlg"), \
QSize())); +    }
+}
+
+
 void CalibrateFlossDlg::fillSchemeList()
 {
     ui.SchemeList->insertItems(0, SchemeManager::schemes());
diff --git a/src/CalibrateFlossDlg.h b/src/CalibrateFlossDlg.h
index ac3b6d1..9df90bc 100644
--- a/src/CalibrateFlossDlg.h
+++ b/src/CalibrateFlossDlg.h
@@ -21,8 +21,10 @@
 #include "ui_CalibrateFloss.h"
 
 
+class QHideEvent;
 class QListWidgetItem;
 class QPixmap;
+class QShowEvent;
 class SchemeManager;
 
 
@@ -34,6 +36,10 @@ public:
     CalibrateFlossDlg(QWidget *, const QString &);
     ~CalibrateFlossDlg();
 
+protected:
+    virtual void hideEvent(QHideEvent *) Q_DECL_OVERRIDE;
+    virtual void showEvent(QShowEvent *) Q_DECL_OVERRIDE;
+
 private slots:
     void on_SchemeList_currentIndexChanged(const QString &);
     void on_ColorList_currentItemChanged(QListWidgetItem *);
diff --git a/src/ExtendPatternDlg.cpp b/src/ExtendPatternDlg.cpp
index 1f6eaca..015ec5c 100644
--- a/src/ExtendPatternDlg.cpp
+++ b/src/ExtendPatternDlg.cpp
@@ -11,9 +11,10 @@
 
 #include "ExtendPatternDlg.h"
 
-
+#include <KConfigGroup>
 #include <KHelpClient>
 #include <KLocalizedString>
+#include <KSharedConfig>
 
 
 ExtendPatternDlg::ExtendPatternDlg(QWidget *parent)
@@ -53,6 +54,24 @@ int ExtendPatternDlg::bottom() const
 }
 
 
+void ExtendPatternDlg::hideEvent(QHideEvent *event)
+{
+    KConfigGroup(KSharedConfig::openConfig(), \
QStringLiteral("DialogSizes")).writeEntry(QStringLiteral("ExtendPatternDlg"), \
size()); +
+    QDialog::hideEvent(event);
+}
+
+
+void ExtendPatternDlg::showEvent(QShowEvent *event)
+{
+    QDialog::showEvent(event);
+
+    if (KConfigGroup(KSharedConfig::openConfig(), \
QStringLiteral("DialogSizes")).hasKey(QStringLiteral("ExtendPatternDlg"))) { +        \
resize(KConfigGroup(KSharedConfig::openConfig(), \
QStringLiteral("DialogSizes")).readEntry(QStringLiteral("ExtendPatternDlg"), \
QSize())); +    }
+}
+
+
 void ExtendPatternDlg::on_DialogButtonBox_accepted()
 {
     accept();
diff --git a/src/ExtendPatternDlg.h b/src/ExtendPatternDlg.h
index 829222f..efa1b63 100644
--- a/src/ExtendPatternDlg.h
+++ b/src/ExtendPatternDlg.h
@@ -18,6 +18,10 @@
 #include <QDialog>
 
 
+class QHideEvent;
+class QShowEvent;
+
+
 class ExtendPatternDlg : public QDialog
 {
     Q_OBJECT
@@ -31,6 +35,10 @@ public:
     int right() const;
     int bottom() const;
 
+protected:
+    virtual void hideEvent(QHideEvent *) Q_DECL_OVERRIDE;
+    virtual void showEvent(QShowEvent *) Q_DECL_OVERRIDE;
+
 private slots:
     void on_DialogButtonBox_accepted();
     void on_DialogButtonBox_rejected();
diff --git a/src/FilePropertiesDlg.cpp b/src/FilePropertiesDlg.cpp
index 6741c12..bcb4b51 100644
--- a/src/FilePropertiesDlg.cpp
+++ b/src/FilePropertiesDlg.cpp
@@ -144,6 +144,24 @@ QString FilePropertiesDlg::flossScheme() const
 }
 
 
+void FilePropertiesDlg::hideEvent(QHideEvent *event)
+{
+    KConfigGroup(KSharedConfig::openConfig(), \
QStringLiteral("DialogSizes")).writeEntry(QStringLiteral("FilePropertiesDlg"), \
size()); +
+    QDialog::hideEvent(event);
+}
+
+
+void FilePropertiesDlg::showEvent(QShowEvent *event)
+{
+    QDialog::showEvent(event);
+
+    if (KConfigGroup(KSharedConfig::openConfig(), \
QStringLiteral("DialogSizes")).hasKey(QStringLiteral("FilePropertiesDlg"))) { +       \
resize(KConfigGroup(KSharedConfig::openConfig(), \
QStringLiteral("DialogSizes")).readEntry(QStringLiteral("FilePropertiesDlg"), \
QSize())); +    }
+}
+
+
 void FilePropertiesDlg::on_UnitsFormat_activated(int index)
 {
     m_unitsFormat = \
                static_cast<Configuration::EnumDocument_UnitsFormat::type>(index);
diff --git a/src/FilePropertiesDlg.h b/src/FilePropertiesDlg.h
index c22ff80..08e9a49 100644
--- a/src/FilePropertiesDlg.h
+++ b/src/FilePropertiesDlg.h
@@ -20,6 +20,8 @@
 
 
 class Document;
+class QHideEvent;
+class QShowEvent;
 class QWidget;
 
 
@@ -46,6 +48,10 @@ public:
     QString instructions() const;
     QString flossScheme() const;
 
+protected:
+    virtual void hideEvent(QHideEvent *) Q_DECL_OVERRIDE;
+    virtual void showEvent(QShowEvent *) Q_DECL_OVERRIDE;
+
 private slots:
     void on_UnitsFormat_activated(int);
     void on_PatternWidth_valueChanged(double);
diff --git a/src/ImageElementDlg.cpp b/src/ImageElementDlg.cpp
index 3d94606..ea1dd4e 100644
--- a/src/ImageElementDlg.cpp
+++ b/src/ImageElementDlg.cpp
@@ -44,6 +44,24 @@ ImageElementDlg::~ImageElementDlg()
 }
 
 
+void ImageElementDlg::hideEvent(QHideEvent *event)
+{
+    KConfigGroup(KSharedConfig::openConfig(), \
QStringLiteral("DialogSizes")).writeEntry(QStringLiteral("ImageElementDlg"), size()); \
+ +    QDialog::hideEvent(event);
+}
+
+
+void ImageElementDlg::showEvent(QShowEvent *event)
+{
+    QDialog::showEvent(event);
+
+    if (KConfigGroup(KSharedConfig::openConfig(), \
QStringLiteral("DialogSizes")).hasKey(QStringLiteral("ImageElementDlg"))) { +        \
resize(KConfigGroup(KSharedConfig::openConfig(), \
QStringLiteral("DialogSizes")).readEntry(QStringLiteral("ImageElementDlg"), \
QSize())); +    }
+}
+
+
 void ImageElementDlg::on_DialogButtonBox_accepted()
 {
     m_imageElement->setPatternRect(m_selectArea->patternRect());
diff --git a/src/ImageElementDlg.h b/src/ImageElementDlg.h
index 3072339..2041ce6 100644
--- a/src/ImageElementDlg.h
+++ b/src/ImageElementDlg.h
@@ -22,6 +22,8 @@
 class Document;
 class ImageElement;
 class SelectArea;
+class QHideEvent;
+class QShowEvent;
 
 
 class ImageElementDlg : public QDialog
@@ -32,6 +34,10 @@ public:
     ImageElementDlg(QWidget *, ImageElement *, Document *);
     ~ImageElementDlg();
 
+protected:
+    virtual void hideEvent(QHideEvent *) Q_DECL_OVERRIDE;
+    virtual void showEvent(QShowEvent *) Q_DECL_OVERRIDE;
+
 private slots:
     void on_DialogButtonBox_accepted();
     void on_DialogButtonBox_rejected();
diff --git a/src/ImportImageDlg.cpp b/src/ImportImageDlg.cpp
index 5db6e8b..40abaca 100644
--- a/src/ImportImageDlg.cpp
+++ b/src/ImportImageDlg.cpp
@@ -95,6 +95,24 @@ bool ImportImageDlg::useFractionals() const
 }
 
 
+void ImportImageDlg::hideEvent(QHideEvent *event)
+{
+    KConfigGroup(KSharedConfig::openConfig(), \
QStringLiteral("DialogSizes")).writeEntry(QStringLiteral("ImportImageDlg"), size()); \
+ +    QDialog::hideEvent(event);
+}
+
+
+void ImportImageDlg::showEvent(QShowEvent *event)
+{
+    QDialog::showEvent(event);
+
+    if (KConfigGroup(KSharedConfig::openConfig(), \
QStringLiteral("DialogSizes")).hasKey(QStringLiteral("ImportImageDlg"))) { +        \
resize(KConfigGroup(KSharedConfig::openConfig(), \
QStringLiteral("DialogSizes")).readEntry(QStringLiteral("ImportImageDlg"), QSize())); \
+    } +}
+
+
 void ImportImageDlg::on_FlossScheme_currentIndexChanged(const QString&)
 {
     createImageMap();
diff --git a/src/ImportImageDlg.h b/src/ImportImageDlg.h
index 9e60ac1..9e6283e 100644
--- a/src/ImportImageDlg.h
+++ b/src/ImportImageDlg.h
@@ -31,6 +31,8 @@
 
 
 class SchemeManager;
+class QHideEvent;
+class QShowEvent;
 
 
 class ImportImageDlg : public QDialog
@@ -50,7 +52,9 @@ public:
     bool useFractionals() const;
 
 protected:
-    virtual void timerEvent(QTimerEvent *);
+    virtual void hideEvent(QHideEvent *) Q_DECL_OVERRIDE;
+    virtual void showEvent(QShowEvent *) Q_DECL_OVERRIDE;
+    virtual void timerEvent(QTimerEvent *) Q_DECL_OVERRIDE;
 
 private slots:
     void on_FlossScheme_currentIndexChanged(const QString &);
diff --git a/src/KeyElementDlg.cpp b/src/KeyElementDlg.cpp
index 4ca2c84..8e2ccf2 100644
--- a/src/KeyElementDlg.cpp
+++ b/src/KeyElementDlg.cpp
@@ -55,6 +55,24 @@ KeyElementDlg::~KeyElementDlg()
 }
 
 
+void KeyElementDlg::hideEvent(QHideEvent *event)
+{
+    KConfigGroup(KSharedConfig::openConfig(), \
QStringLiteral("DialogSizes")).writeEntry(QStringLiteral("KeyElementDlg"), size()); +
+    QDialog::hideEvent(event);
+}
+
+
+void KeyElementDlg::showEvent(QShowEvent *event)
+{
+    QDialog::showEvent(event);
+
+    if (KConfigGroup(KSharedConfig::openConfig(), \
QStringLiteral("DialogSizes")).hasKey(QStringLiteral("KeyElementDlg"))) { +        \
resize(KConfigGroup(KSharedConfig::openConfig(), \
QStringLiteral("DialogSizes")).readEntry(QStringLiteral("KeyElementDlg"), QSize())); \
+    } +}
+
+
 void KeyElementDlg::on_DialogButtonBox_accepted()
 {
     m_keyElement->m_margins = QMargins(ui.MarginLeft->value(), \
                ui.MarginTop->value(), ui.MarginRight->value(), \
                ui.MarginBottom->value());
diff --git a/src/KeyElementDlg.h b/src/KeyElementDlg.h
index a04442b..eaa588b 100644
--- a/src/KeyElementDlg.h
+++ b/src/KeyElementDlg.h
@@ -19,6 +19,8 @@
 
 
 class KeyElement;
+class QHideEvent;
+class QShowEvent;
 
 
 class KeyElementDlg : public QDialog
@@ -29,6 +31,10 @@ public:
     KeyElementDlg(QWidget *, KeyElement *);
     ~KeyElementDlg();
 
+protected:
+    virtual void hideEvent(QHideEvent *) Q_DECL_OVERRIDE;
+    virtual void showEvent(QShowEvent *) Q_DECL_OVERRIDE;
+
 private slots:
     void on_DialogButtonBox_accepted();
     void on_DialogButtonBox_rejected();
diff --git a/src/LibraryFilePathsDlg.cpp b/src/LibraryFilePathsDlg.cpp
index 5fab159..49934ae 100644
--- a/src/LibraryFilePathsDlg.cpp
+++ b/src/LibraryFilePathsDlg.cpp
@@ -11,8 +11,10 @@
 
 #include "LibraryFilePathsDlg.h"
 
+#include <KConfigGroup>
 #include <KHelpClient>
 #include <KLocalizedString>
+#include <KSharedConfig>
 
 
 LibraryFilePathsDlg::LibraryFilePathsDlg(QWidget *parent, const QString&, \
QStringList paths) @@ -34,6 +36,24 @@ LibraryFilePathsDlg::~LibraryFilePathsDlg()
 }
 
 
+void LibraryFilePathsDlg::hideEvent(QHideEvent *event)
+{
+    KConfigGroup(KSharedConfig::openConfig(), \
QStringLiteral("DialogSizes")).writeEntry(QStringLiteral("LibraryFilePathsDlg"), \
size()); +
+    QDialog::hideEvent(event);
+}
+
+
+void LibraryFilePathsDlg::showEvent(QShowEvent *event)
+{
+    QDialog::showEvent(event);
+
+    if (KConfigGroup(KSharedConfig::openConfig(), \
QStringLiteral("DialogSizes")).hasKey(QStringLiteral("LibraryFilePathsDlg"))) { +     \
resize(KConfigGroup(KSharedConfig::openConfig(), \
QStringLiteral("DialogSizes")).readEntry(QStringLiteral("LibraryFilePathsDlg"), \
QSize())); +    }
+}
+
+
 void LibraryFilePathsDlg::on_DialogButtonBox_accepted()
 {
     accept();
diff --git a/src/LibraryFilePathsDlg.h b/src/LibraryFilePathsDlg.h
index 5b832ad..1c4c6f8 100644
--- a/src/LibraryFilePathsDlg.h
+++ b/src/LibraryFilePathsDlg.h
@@ -18,6 +18,10 @@
 #include "ui_LibraryFilePaths.h"
 
 
+class QHideEvent;
+class QShowEvent;
+
+
 class LibraryFilePathsDlg : public QDialog
 {
     Q_OBJECT
@@ -26,6 +30,10 @@ public:
     LibraryFilePathsDlg(QWidget *, const QString &, QStringList);
     ~LibraryFilePathsDlg();
 
+protected:
+    virtual void hideEvent(QHideEvent *) Q_DECL_OVERRIDE;
+    virtual void showEvent(QShowEvent *) Q_DECL_OVERRIDE;
+
 private slots:
     void on_DialogButtonBox_accepted();
     void on_DialogButtonBox_helpRequested();
diff --git a/src/LibraryManagerDlg.cpp b/src/LibraryManagerDlg.cpp
index 274d892..f1e0468 100644
--- a/src/LibraryManagerDlg.cpp
+++ b/src/LibraryManagerDlg.cpp
@@ -89,6 +89,24 @@ bool LibraryManagerDlg::event(QEvent *event)
 }
 
 
+void LibraryManagerDlg::hideEvent(QHideEvent *event)
+{
+    KConfigGroup(KSharedConfig::openConfig(), \
QStringLiteral("DialogSizes")).writeEntry(QStringLiteral("LibraryManagerDlg"), \
size()); +
+    QDialog::hideEvent(event);
+}
+
+
+void LibraryManagerDlg::showEvent(QShowEvent *event)
+{
+    QDialog::showEvent(event);
+
+    if (KConfigGroup(KSharedConfig::openConfig(), \
QStringLiteral("DialogSizes")).hasKey(QStringLiteral("LibraryManagerDlg"))) { +       \
resize(KConfigGroup(KSharedConfig::openConfig(), \
QStringLiteral("DialogSizes")).readEntry(QStringLiteral("LibraryManagerDlg"), \
QSize())); +    }
+}
+
+
 void LibraryManagerDlg::setCellSize(double cellWidth, double cellHeight)
 {
     ui.LibraryIcons->setCellSize(cellWidth, cellHeight);
diff --git a/src/LibraryManagerDlg.h b/src/LibraryManagerDlg.h
index b436733..bf486a0 100644
--- a/src/LibraryManagerDlg.h
+++ b/src/LibraryManagerDlg.h
@@ -23,6 +23,8 @@
 
 class LibraryListWidgetItem;
 class LibraryTreeWidgetItem;
+class QHideEvent;
+class QShowEvent;
 
 
 class LibraryManagerDlg : public QDialog
@@ -36,7 +38,9 @@ public:
     LibraryTreeWidgetItem *currentLibrary();
 
 protected:
-    virtual bool event(QEvent *);
+    virtual bool event(QEvent *) Q_DECL_OVERRIDE;
+    virtual void hideEvent(QHideEvent *) Q_DECL_OVERRIDE;
+    virtual void showEvent(QShowEvent *) Q_DECL_OVERRIDE;
 
 public slots:
     void setCellSize(double, double);
diff --git a/src/LibraryPatternPropertiesDlg.cpp \
b/src/LibraryPatternPropertiesDlg.cpp index fb4d270..761bf8d 100644
--- a/src/LibraryPatternPropertiesDlg.cpp
+++ b/src/LibraryPatternPropertiesDlg.cpp
@@ -11,8 +11,10 @@
 
 #include "LibraryPatternPropertiesDlg.h"
 
+#include <KConfigGroup>
 #include <KHelpClient>
 #include <KLocalizedString>
+#include <KSharedConfig>
 
 
 LibraryPatternPropertiesDlg::LibraryPatternPropertiesDlg(QWidget *parent, qint32 \
key, Qt::KeyboardModifiers modifiers, qint16 baseline, const QString &scheme, int \
width, int height, const QIcon &icon) @@ -53,6 +55,24 @@ qint16 \
LibraryPatternPropertiesDlg::baseline() const  }
 
 
+void LibraryPatternPropertiesDlg::hideEvent(QHideEvent *event)
+{
+    KConfigGroup(KSharedConfig::openConfig(), \
QStringLiteral("DialogSizes")).writeEntry(QStringLiteral("LibraryPatternPropertiesDlg"), \
size()); +
+    QDialog::hideEvent(event);
+}
+
+
+void LibraryPatternPropertiesDlg::showEvent(QShowEvent *event)
+{
+    QDialog::showEvent(event);
+
+    if (KConfigGroup(KSharedConfig::openConfig(), \
QStringLiteral("DialogSizes")).hasKey(QStringLiteral("LibraryPatternPropertiesDlg"))) \
{ +        resize(KConfigGroup(KSharedConfig::openConfig(), \
QStringLiteral("DialogSizes")).readEntry(QStringLiteral("LibraryPatternPropertiesDlg"), \
QSize())); +    }
+}
+
+
 void LibraryPatternPropertiesDlg::on_DialogButtonBox_accepted()
 {
     accept();
diff --git a/src/LibraryPatternPropertiesDlg.h b/src/LibraryPatternPropertiesDlg.h
index e01f7ce..8315783 100644
--- a/src/LibraryPatternPropertiesDlg.h
+++ b/src/LibraryPatternPropertiesDlg.h
@@ -18,6 +18,10 @@
 #include "ui_LibraryPatternProperties.h"
 
 
+class QHideEvent;
+class QShowEvent;
+
+
 class LibraryPatternPropertiesDlg : public QDialog
 {
     Q_OBJECT
@@ -30,6 +34,10 @@ public:
     Qt::KeyboardModifiers modifiers() const;
     qint16 baseline() const;
 
+protected:
+    virtual void hideEvent(QHideEvent *) Q_DECL_OVERRIDE;
+    virtual void showEvent(QShowEvent *) Q_DECL_OVERRIDE;
+
 private slots:
     void on_DialogButtonBox_accepted();
     void on_DialogButtonBox_rejected();
diff --git a/src/NewFlossDlg.cpp b/src/NewFlossDlg.cpp
index 049297f..52327b0 100644
--- a/src/NewFlossDlg.cpp
+++ b/src/NewFlossDlg.cpp
@@ -11,9 +11,11 @@
 
 #include "NewFlossDlg.h"
 
+#include <KConfigGroup>
 #include <KHelpClient>
 #include <KLocalizedString>
 #include <KMessageBox>
+#include <KSharedConfig>
 
 #include "FlossScheme.h"
 
@@ -42,6 +44,24 @@ Floss *NewFlossDlg::floss()
 }
 
 
+void NewFlossDlg::hideEvent(QHideEvent *event)
+{
+    KConfigGroup(KSharedConfig::openConfig(), \
QStringLiteral("DialogSizes")).writeEntry(QStringLiteral("NewFlossDlg"), size()); +
+    QDialog::hideEvent(event);
+}
+
+
+void NewFlossDlg::showEvent(QShowEvent *event)
+{
+    QDialog::showEvent(event);
+
+    if (KConfigGroup(KSharedConfig::openConfig(), \
QStringLiteral("DialogSizes")).hasKey(QStringLiteral("NewFlossDlg"))) { +        \
resize(KConfigGroup(KSharedConfig::openConfig(), \
QStringLiteral("DialogSizes")).readEntry(QStringLiteral("NewFlossDlg"), QSize())); +  \
} +}
+
+
 void NewFlossDlg::on_FlossName_textEdited(const QString &text)
 {
     if (!text.isEmpty() && !ui.FlossDescription->text().isEmpty()) {
diff --git a/src/NewFlossDlg.h b/src/NewFlossDlg.h
index 9a43af0..afdaa71 100644
--- a/src/NewFlossDlg.h
+++ b/src/NewFlossDlg.h
@@ -17,7 +17,8 @@
 
 #include "ui_NewFloss.h"
 
-
+class QHideEvent;
+class QShowEvent;
 class QString;
 class QWidget;
 
@@ -35,6 +36,10 @@ public:
 
     Floss *floss();
 
+protected:
+    virtual void hideEvent(QHideEvent *) Q_DECL_OVERRIDE;
+    virtual void showEvent(QShowEvent *) Q_DECL_OVERRIDE;
+
 private slots:
     void on_FlossName_textEdited(const QString &);
     void on_FlossDescription_textEdited(const QString &);
diff --git a/src/PagePropertiesDlg.cpp b/src/PagePropertiesDlg.cpp
index 91d12b5..5caf0c4 100644
--- a/src/PagePropertiesDlg.cpp
+++ b/src/PagePropertiesDlg.cpp
@@ -11,8 +11,10 @@
 
 #include "PagePropertiesDlg.h"
 
+#include <KConfigGroup>
 #include <KHelpClient>
 #include <KLocalizedString>
+#include <KSharedConfig>
 
 #include "Page.h"
 #include "PageLayoutEditor.h"
@@ -58,6 +60,24 @@ int PagePropertiesDlg::gridSize() const
 }
 
 
+void PagePropertiesDlg::hideEvent(QHideEvent *event)
+{
+    KConfigGroup(KSharedConfig::openConfig(), \
QStringLiteral("DialogSizes")).writeEntry(QStringLiteral("PagePropertiesDlg"), \
size()); +
+    QDialog::hideEvent(event);
+}
+
+
+void PagePropertiesDlg::showEvent(QShowEvent *event)
+{
+    QDialog::showEvent(event);
+
+    if (KConfigGroup(KSharedConfig::openConfig(), \
QStringLiteral("DialogSizes")).hasKey(QStringLiteral("PagePropertiesDlg"))) { +       \
resize(KConfigGroup(KSharedConfig::openConfig(), \
QStringLiteral("DialogSizes")).readEntry(QStringLiteral("PagePropertiesDlg"), \
QSize())); +    }
+}
+
+
 void PagePropertiesDlg::on_DialogButtonBox_accepted()
 {
     accept();
diff --git a/src/PagePropertiesDlg.h b/src/PagePropertiesDlg.h
index 272d0ed..8ad3dae 100644
--- a/src/PagePropertiesDlg.h
+++ b/src/PagePropertiesDlg.h
@@ -19,6 +19,8 @@
 
 
 class PagePreviewListWidgetItem;
+class QHideEvent;
+class QShowEvent;
 
 
 class PagePropertiesDlg : public QDialog
@@ -33,6 +35,10 @@ public:
     bool showGrid() const;
     int gridSize() const;
 
+protected:
+    virtual void hideEvent(QHideEvent *) Q_DECL_OVERRIDE;
+    virtual void showEvent(QShowEvent *) Q_DECL_OVERRIDE;
+
 private slots:
     void on_DialogButtonBox_accepted();
     void on_DialogButtonBox_rejected();
diff --git a/src/PaletteManagerDlg.cpp b/src/PaletteManagerDlg.cpp
index 82b49aa..b2a9bd2 100644
--- a/src/PaletteManagerDlg.cpp
+++ b/src/PaletteManagerDlg.cpp
@@ -61,6 +61,24 @@ const DocumentPalette &PaletteManagerDlg::palette() const
 }
 
 
+void PaletteManagerDlg::hideEvent(QHideEvent *event)
+{
+    KConfigGroup(KSharedConfig::openConfig(), \
QStringLiteral("DialogSizes")).writeEntry(QStringLiteral("PaletteManagerDlg"), \
size()); +
+    QDialog::hideEvent(event);
+}
+
+
+void PaletteManagerDlg::showEvent(QShowEvent *event)
+{
+    QDialog::showEvent(event);
+
+    if (KConfigGroup(KSharedConfig::openConfig(), \
QStringLiteral("DialogSizes")).hasKey(QStringLiteral("PaletteManagerDlg"))) { +       \
resize(KConfigGroup(KSharedConfig::openConfig(), \
QStringLiteral("DialogSizes")).readEntry(QStringLiteral("PaletteManagerDlg"), \
QSize())); +    }
+}
+
+
 void PaletteManagerDlg::on_ColorList_currentRowChanged(int currentRow)
 {
     ui.AddFloss->setEnabled((currentRow != -1) && symbolsAvailable());
diff --git a/src/PaletteManagerDlg.h b/src/PaletteManagerDlg.h
index 90ff00a..f233523 100644
--- a/src/PaletteManagerDlg.h
+++ b/src/PaletteManagerDlg.h
@@ -25,6 +25,8 @@ class Document;
 class DocumentFloss;
 class SchemeManager;
 class SymbolSelectorDlg;
+class QHideEvent;
+class QShowEvent;
 
 
 class PaletteManagerDlg : public QDialog
@@ -37,6 +39,10 @@ public:
 
     const DocumentPalette &palette() const;
 
+protected:
+    virtual void hideEvent(QHideEvent *) Q_DECL_OVERRIDE;
+    virtual void showEvent(QShowEvent *) Q_DECL_OVERRIDE;
+
 private slots:
     void on_ColorList_currentRowChanged(int);
     void on_CurrentList_currentRowChanged(int);
diff --git a/src/PatternElementDlg.cpp b/src/PatternElementDlg.cpp
index f9b0135..9025e33 100644
--- a/src/PatternElementDlg.cpp
+++ b/src/PatternElementDlg.cpp
@@ -80,6 +80,24 @@ PlanElement *PatternElementDlg::planElement() const
 }
 
 
+void PatternElementDlg::hideEvent(QHideEvent *event)
+{
+    KConfigGroup(KSharedConfig::openConfig(), \
QStringLiteral("DialogSizes")).writeEntry(QStringLiteral("PatternElementDlg"), \
size()); +
+    QDialog::hideEvent(event);
+}
+
+
+void PatternElementDlg::showEvent(QShowEvent *event)
+{
+    QDialog::showEvent(event);
+
+    if (KConfigGroup(KSharedConfig::openConfig(), \
QStringLiteral("DialogSizes")).hasKey(QStringLiteral("PatternElementDlg"))) { +       \
resize(KConfigGroup(KSharedConfig::openConfig(), \
QStringLiteral("DialogSizes")).readEntry(QStringLiteral("PatternElementDlg"), \
QSize())); +    }
+}
+
+
 void PatternElementDlg::on_DialogButtonBox_accepted()
 {
     m_patternElement->setPatternRect(m_selectArea->patternRect());
diff --git a/src/PatternElementDlg.h b/src/PatternElementDlg.h
index 507bea0..f24548e 100644
--- a/src/PatternElementDlg.h
+++ b/src/PatternElementDlg.h
@@ -24,6 +24,8 @@ class Document;
 class PlanElement;
 class PatternElement;
 class SelectArea;
+class QHideEvent;
+class QShowEvent;
 
 
 class PatternElementDlg : public QDialog
@@ -37,6 +39,10 @@ public:
     bool showPlan() const;
     PlanElement *planElement() const;
 
+protected:
+    virtual void hideEvent(QHideEvent *) Q_DECL_OVERRIDE;
+    virtual void showEvent(QShowEvent *) Q_DECL_OVERRIDE;
+
 private slots:
     void on_DialogButtonBox_accepted();
     void on_DialogButtonBox_rejected();
diff --git a/src/PrintSetupDlg.cpp b/src/PrintSetupDlg.cpp
index ba1e4f3..7617553 100644
--- a/src/PrintSetupDlg.cpp
+++ b/src/PrintSetupDlg.cpp
@@ -15,6 +15,7 @@
 
 #include <QColorDialog>
 #include <QFontDialog>
+#include <QHideEvent>
 #include <QInputDialog>
 #include <QMargins>
 #include <QMenu>
@@ -93,10 +94,22 @@ const PrinterConfiguration &PrintSetupDlg::printerConfiguration() \
const  }
 
 
+void PrintSetupDlg::hideEvent(QHideEvent *event)
+{
+    KConfigGroup(KSharedConfig::openConfig(), \
QStringLiteral("DialogSizes")).writeEntry(QStringLiteral("PrintSetupDlg"), size()); +
+    QDialog::hideEvent(event);
+}
+
+
 void PrintSetupDlg::showEvent(QShowEvent *event)
 {
     QDialog::showEvent(event);
 
+    if (KConfigGroup(KSharedConfig::openConfig(), \
QStringLiteral("DialogSizes")).hasKey(QStringLiteral("PrintSetupDlg"))) { +        \
resize(KConfigGroup(KSharedConfig::openConfig(), \
QStringLiteral("DialogSizes")).readEntry(QStringLiteral("PrintSetupDlg"), QSize())); \
+    } +
     if (ui.Pages->count() == 0) {
         initialiseFromConfig();
     }
diff --git a/src/PrintSetupDlg.h b/src/PrintSetupDlg.h
index 18914af..4a59cea 100644
--- a/src/PrintSetupDlg.h
+++ b/src/PrintSetupDlg.h
@@ -23,6 +23,7 @@
 #include "ui_PrintSetup.h"
 
 
+class QHideEvent;
 class QResizeEvent;
 class QShowEvent;
 class QString;
@@ -43,7 +44,8 @@ public:
     const PrinterConfiguration &printerConfiguration() const;
 
 protected:
-    void showEvent(QShowEvent *);
+    virtual void hideEvent(QHideEvent *) Q_DECL_OVERRIDE;
+    virtual void showEvent(QShowEvent *) Q_DECL_OVERRIDE;
 
 private slots:
     void on_PaperSize_currentIndexChanged(const QString &);
diff --git a/src/SymbolSelectorDlg.cpp b/src/SymbolSelectorDlg.cpp
index 46423fe..8bd234b 100644
--- a/src/SymbolSelectorDlg.cpp
+++ b/src/SymbolSelectorDlg.cpp
@@ -92,6 +92,34 @@ qint16 SymbolSelectorDlg::selectedSymbol()
 
 
 /**
+ * Override hideEvent to save the dialogs size.
+ *
+ * @param event a pointer to a QHideEvent
+ */
+void SymbolSelectorDlg::hideEvent(QHideEvent *event)
+{
+    KConfigGroup(KSharedConfig::openConfig(), \
QStringLiteral("DialogSizes")).writeEntry(QStringLiteral("SymbolSelectorDlg"), \
size()); +
+    QDialog::hideEvent(event);
+}
+
+
+/**
+ * Override showEvent to restore the dialogs size.
+ *
+ * @param event a pointer to a QShowEvent
+ */
+void SymbolSelectorDlg::showEvent(QShowEvent *event)
+{
+    QDialog::showEvent(event);
+
+    if (KConfigGroup(KSharedConfig::openConfig(), \
QStringLiteral("DialogSizes")).hasKey(QStringLiteral("SymbolSelectorDlg"))) { +       \
resize(KConfigGroup(KSharedConfig::openConfig(), \
QStringLiteral("DialogSizes")).readEntry(QStringLiteral("SymbolSelectorDlg"), \
QSize())); +    }
+}
+
+
+/**
  * Set the selected symbol from the selected icon.
  * This slot is connected to the SymbolListWidget executed signal.
  * The index is stored as a data item in the QListWidgetItem.
diff --git a/src/SymbolSelectorDlg.h b/src/SymbolSelectorDlg.h
index fab43aa..6896944 100644
--- a/src/SymbolSelectorDlg.h
+++ b/src/SymbolSelectorDlg.h
@@ -25,6 +25,8 @@
 
 
 class SymbolLibrary;
+class QHideEvent;
+class QShowEvent;
 
 
 /**
@@ -46,6 +48,10 @@ public:
     void setSelectedSymbol(qint16 symbol, const QList<qint16> &usedSymbols);
     qint16 selectedSymbol();
 
+protected:
+    virtual void hideEvent(QHideEvent *) Q_DECL_OVERRIDE;
+    virtual void showEvent(QShowEvent *) Q_DECL_OVERRIDE;
+
 protected slots:
     void on_SymbolTable_itemClicked(QListWidgetItem *item);
 
diff --git a/src/TextElementDlg.cpp b/src/TextElementDlg.cpp
index 2e32480..f9c0666 100644
--- a/src/TextElementDlg.cpp
+++ b/src/TextElementDlg.cpp
@@ -75,6 +75,24 @@ TextElementDlg::~TextElementDlg()
 }
 
 
+void TextElementDlg::hideEvent(QHideEvent *event)
+{
+    KConfigGroup(KSharedConfig::openConfig(), \
QStringLiteral("DialogSizes")).writeEntry(QStringLiteral("TextElementDlg"), size()); \
+ +    QDialog::hideEvent(event);
+}
+
+
+void TextElementDlg::showEvent(QShowEvent *event)
+{
+    QDialog::showEvent(event);
+
+    if (KConfigGroup(KSharedConfig::openConfig(), \
QStringLiteral("DialogSizes")).hasKey(QStringLiteral("TextElementDlg"))) { +        \
resize(KConfigGroup(KSharedConfig::openConfig(), \
QStringLiteral("DialogSizes")).readEntry(QStringLiteral("TextElementDlg"), QSize())); \
+    } +}
+
+
 void TextElementDlg::on_FillBackground_toggled(bool checked)
 {
     ui.Text->setAutoFillBackground(checked);
diff --git a/src/TextElementDlg.h b/src/TextElementDlg.h
index 8f0c743..a5d206d 100644
--- a/src/TextElementDlg.h
+++ b/src/TextElementDlg.h
@@ -19,6 +19,8 @@
 
 
 class TextElement;
+class QHideEvent;
+class QShowEvent;
 
 
 class TextElementDlg : public QDialog
@@ -29,6 +31,10 @@ public:
     TextElementDlg(QWidget *, TextElement *);
     ~TextElementDlg();
 
+protected:
+    virtual void hideEvent(QHideEvent *) Q_DECL_OVERRIDE;
+    virtual void showEvent(QShowEvent *) Q_DECL_OVERRIDE;
+
 private slots:
     void on_FillBackground_toggled(bool);
     void on_BackgroundColor_activated(const QColor &);
diff --git a/src/TextToolDlg.cpp b/src/TextToolDlg.cpp
index 46702c9..0eb37f3 100644
--- a/src/TextToolDlg.cpp
+++ b/src/TextToolDlg.cpp
@@ -68,6 +68,24 @@ QImage TextToolDlg::image()
 }
 
 
+void TextToolDlg::hideEvent(QHideEvent *event)
+{
+    KConfigGroup(KSharedConfig::openConfig(), \
QStringLiteral("DialogSizes")).writeEntry(QStringLiteral("TextToolDlg"), size()); +
+    QDialog::hideEvent(event);
+}
+
+
+void TextToolDlg::showEvent(QShowEvent *event)
+{
+    QDialog::showEvent(event);
+
+    if (KConfigGroup(KSharedConfig::openConfig(), \
QStringLiteral("DialogSizes")).hasKey(QStringLiteral("PrintSetupDlg"))) { +        \
resize(KConfigGroup(KSharedConfig::openConfig(), \
QStringLiteral("DialogSizes")).readEntry(QStringLiteral("TextToolDlg"), QSize())); +  \
} +}
+
+
 void TextToolDlg::on_TextToolFont_currentFontChanged(const QFont &font)
 {
     QFont f = ui.TextToolText->font();
diff --git a/src/TextToolDlg.h b/src/TextToolDlg.h
index 4158a73..877983c 100644
--- a/src/TextToolDlg.h
+++ b/src/TextToolDlg.h
@@ -20,6 +20,10 @@
 #include "ui_TextTool.h"
 
 
+class QHideEvent;
+class QShowEvent;
+
+
 class TextToolDlg : public QDialog
 {
     Q_OBJECT
@@ -30,6 +34,10 @@ public:
 
     QImage image();
 
+protected:
+    virtual void hideEvent(QHideEvent *);
+    virtual void showEvent(QShowEvent *);
+
 private slots:
     void on_TextToolFont_currentFontChanged(const QFont &);
     void on_TextToolSize_valueChanged(int);


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

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