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

List:       kde-commits
Subject:    [kdepim] headerthemeeditor: improve add extra page
From:       Montel Laurent <montel () kde ! org>
Date:       2013-04-15 6:57:19
Message-ID: 20130415065719.29A33A605E () git ! kde ! org
[Download RAW message or body]

Git commit db92b65dd9b77331531cb7f3c6e5ffaafb3cc05b by Montel Laurent.
Committed on 15/04/2013 at 08:57.
Pushed by mlaurent into branch 'master'.

improve add extra page

M  +5    -0    headerthemeeditor/desktopfilepage.cpp
M  +2    -0    headerthemeeditor/desktopfilepage.h
M  +11   -12   headerthemeeditor/themeeditormainwindow.cpp
M  +8    -5    headerthemeeditor/themeeditorpage.cpp
M  +1    -1    headerthemeeditor/themeeditorpage.h

http://commits.kde.org/kdepim/db92b65dd9b77331531cb7f3c6e5ffaafb3cc05b

diff --git a/headerthemeeditor/desktopfilepage.cpp \
b/headerthemeeditor/desktopfilepage.cpp index fd86662..5715530 100644
--- a/headerthemeeditor/desktopfilepage.cpp
+++ b/headerthemeeditor/desktopfilepage.cpp
@@ -58,6 +58,11 @@ DesktopFilePage::~DesktopFilePage()
 {
 }
 
+QString DesktopFilePage::filename() const
+{
+    return mFilename->text();
+}
+
 void DesktopFilePage::saveTheme(const QString &path)
 {
     QString filename;
diff --git a/headerthemeeditor/desktopfilepage.h \
b/headerthemeeditor/desktopfilepage.h index 094c7c7..56e5463 100644
--- a/headerthemeeditor/desktopfilepage.h
+++ b/headerthemeeditor/desktopfilepage.h
@@ -35,6 +35,8 @@ public:
     ~DesktopFilePage();
 
     void saveTheme(const QString &path);
+
+    QString filename() const;
 private:
     KLineEdit *mName;
     KLineEdit *mDescription;
diff --git a/headerthemeeditor/themeeditormainwindow.cpp \
b/headerthemeeditor/themeeditormainwindow.cpp index b2ce808..b3d2e67 100644
--- a/headerthemeeditor/themeeditormainwindow.cpp
+++ b/headerthemeeditor/themeeditormainwindow.cpp
@@ -62,7 +62,8 @@ void ThemeEditorMainWindow::slotCloseTheme()
 
 void ThemeEditorMainWindow::slotAddExtraPage()
 {
-    //TODO
+    if (mThemeEditor)
+        mThemeEditor->addExtraPage();
 }
 
 void ThemeEditorMainWindow::savePreviousProject(bool close)
@@ -72,17 +73,15 @@ void ThemeEditorMainWindow::savePreviousProject(bool close)
             mThemeEditor->saveTheme(mProjectDirectory);
         }
     }
-    if (close)
-        return;
-
-    delete mThemeEditor;
-
-    mProjectDirectory = KFileDialog::getExistingDirectory(KUrl(), this, i18n("Select \
                theme directory"));
-    if (!mProjectDirectory.isEmpty()) {
-        mThemeEditor = new ThemeEditorPage;
-        setCentralWidget(mThemeEditor);
-    } else {
-        setCentralWidget(0);
+    if (!close) {
+        delete mThemeEditor;
+        mProjectDirectory = KFileDialog::getExistingDirectory(KUrl(), this, \
i18n("Select theme directory")); +        if (!mProjectDirectory.isEmpty()) {
+            mThemeEditor = new ThemeEditorPage;
+            setCentralWidget(mThemeEditor);
+        } else {
+            setCentralWidget(0);
+        }
     }
 }
 
diff --git a/headerthemeeditor/themeeditorpage.cpp \
b/headerthemeeditor/themeeditorpage.cpp index 6308f5e..28e7ff9 100644
--- a/headerthemeeditor/themeeditorpage.cpp
+++ b/headerthemeeditor/themeeditorpage.cpp
@@ -22,6 +22,7 @@
 
 #include <KTabWidget>
 #include <KLocale>
+#include <KInputDialog>
 
 #include <QHBoxLayout>
 
@@ -46,12 +47,14 @@ ThemeEditorPage::~ThemeEditorPage()
     mExtraPage.clear();
 }
 
-void ThemeEditorPage::addExtraPage(const QString &filename)
+void ThemeEditorPage::addExtraPage()
 {
-    EditorPage *extraPage = new EditorPage;
-    //TODO customize
-    mTabWidget->addTab(extraPage, filename);
-    mExtraPage.append(extraPage);
+    const QString filename = KInputDialog::getText(i18n("Filename of extra page"), \
i18n("Filename:")); +    if (!filename.isEmpty()) {
+        EditorPage *extraPage = new EditorPage;
+        mTabWidget->addTab(extraPage, filename);
+        mExtraPage.append(extraPage);
+    }
 }
 
 void ThemeEditorPage::saveTheme(const QString &path)
diff --git a/headerthemeeditor/themeeditorpage.h \
b/headerthemeeditor/themeeditorpage.h index 2d352a2..8b561e1 100644
--- a/headerthemeeditor/themeeditorpage.h
+++ b/headerthemeeditor/themeeditorpage.h
@@ -32,7 +32,7 @@ public:
     ~ThemeEditorPage();
 
     void saveTheme(const QString &path);
-    void addExtraPage(const QString &filename);
+    void addExtraPage();
 private:
     KTabWidget *mTabWidget;
     EditorPage *mEditorPage;


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

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