[kde-doc-english] [calligra] kexi/main: GUI: Main Window: "Open Recent" page becomes more generic "Welcome" page

Jaroslaw Staniek staniek at kde.org
Fri Sep 30 00:00:31 UTC 2011


Git commit a13c40cbec997c86c18f2fac010d409294a563ec by Jaroslaw Staniek.
Committed on 30/09/2011 at 01:55.
Pushed by staniek into branch 'master'.

GUI: Main Window: "Open Recent" page becomes more generic "Welcome" page

DIGEST: In Kexi, "Open Recent" page becomes more generic "Welcome" page

M  +1    -1    kexi/main/CMakeLists.txt
M  +12   -42   kexi/main/KexiMainWindow.cpp
M  +1    -1    kexi/main/KexiMainWindow.h
M  +7    -8    kexi/main/KexiMainWindow_p.h
R  +26   -26   kexi/main/startup/KexiWelcomeAssistant.cpp [from: kexi/main/startup/KexiRecentProjectsAssistant.cpp - 081% similarity]
R  +10   -10   kexi/main/startup/KexiWelcomeAssistant.h [from: kexi/main/startup/KexiRecentProjectsAssistant.h - 082% similarity]

http://commits.kde.org/calligra/a13c40cbec997c86c18f2fac010d409294a563ec

diff --git a/kexi/main/CMakeLists.txt b/kexi/main/CMakeLists.txt
index 8154f5d..759250e 100644
--- a/kexi/main/CMakeLists.txt
+++ b/kexi/main/CMakeLists.txt
@@ -23,7 +23,7 @@ kexinewstuff.cpp
 startup/KexiConnSelector.cpp
 startup/KexiNewProjectAssistant.cpp
 startup/KexiOpenProjectAssistant.cpp
-startup/KexiRecentProjectsAssistant.cpp
+startup/KexiWelcomeAssistant.cpp
 startup/KexiImportExportAssistant.cpp
 startup/KexiProjectSelector.cpp
 startup/KexiStartupFileWidget.cpp
diff --git a/kexi/main/KexiMainWindow.cpp b/kexi/main/KexiMainWindow.cpp
index cd1eb06..6d43a72 100644
--- a/kexi/main/KexiMainWindow.cpp
+++ b/kexi/main/KexiMainWindow.cpp
@@ -46,7 +46,6 @@
 #include <kapplication.h>
 #include <kcmdlineargs.h>
 #include <kaction.h>
-#include <KRecentFilesAction>
 #include <KActionCollection>
 #include <kactionmenu.h>
 #include <ktoggleaction.h>
@@ -68,7 +67,6 @@
 #include <kimageio.h>
 #include <khelpmenu.h>
 #include <kfiledialog.h>
-#include <krecentdocument.h>
 #include <KMenu>
 #include <KXMLGUIFactory>
 #include <KMultiTabBar>
@@ -109,7 +107,7 @@
 #include "startup/KexiStartup.h"
 #include "startup/KexiNewProjectAssistant.h"
 #include "startup/KexiOpenProjectAssistant.h"
-#include "startup/KexiRecentProjectsAssistant.h"
+#include "startup/KexiWelcomeAssistant.h"
 #include "startup/KexiImportExportAssistant.h"
 #include "startup/KexiStartupDialog.h"
 #include "startup/KexiStartupFileWidget.h"
@@ -118,13 +116,6 @@
 //2.x #include "printing/kexisimpleprintingpart.h"
 //2.x #include "printing/kexisimpleprintingpagesetup.h"
 
-//Extreme verbose debug
-//#if defined(Q_WS_WIN)
-//# include <krecentdirs.h>
-//# include <win32_utils.h>
-//# define KexiVDebug kDebug()
-//#endif
-
 #if !defined(KexiVDebug)
 # define KexiVDebug if (0) kDebug()
 #endif
@@ -681,14 +672,15 @@ void KexiMainWindow::setupActions()
 #endif
 
     {
-        ac->addAction("project_open_recent",
-            action = d->action_open_recent = new KexiMenuWidgetAction(KStandardAction::OpenRecent, this));
+        ac->addAction("project_welcome",
+            action = d->action_project_welcome = new KexiMenuWidgetAction(
+                KIcon(), i18n("Welcome"), this));
             addThreeDotsToActionText(action);
-        connect(action, SIGNAL(triggered()), this, SLOT(slotProjectOpenRecent()));
-        setupMainMenuActionShortcut(action, SLOT(slotProjectOpenRecent()));
-        action->setToolTip(i18n("Open recent project"));
+        connect(action, SIGNAL(triggered()), this, SLOT(slotProjectWelcome()));
+        setupMainMenuActionShortcut(action, SLOT(slotProjectWelcome()));
+        action->setToolTip(i18n("Show Welcome page"));
         action->setWhatsThis(
-            i18n("Opens one of the recently opened project. Currently opened project is not affected."));
+            i18n("Shows Welcome page with list of recently opened projects and other information. "));
     }
 
     ac->addAction("project_save",
@@ -1565,7 +1557,7 @@ tristate KexiMainWindow::startup()
         break;
     case KexiStartupHandler::ShowWelcomeScreen:
         //! @todo show welcome screen as soon as is available
-        QTimer::singleShot(1, this, SLOT(slotProjectOpenRecent()));
+        QTimer::singleShot(1, this, SLOT(slotProjectWelcome()));
         break;
     default:
         d->updatePropEditorVisibility(Kexi::NoViewMode);
@@ -1664,25 +1656,6 @@ tristate KexiMainWindow::createProjectFromTemplate(const KexiProjectData& projec
 #else
 #pragma WARNING( TODO - remove win32 case )
 #endif
-        /*TODO?
-        #ifdef Q_WS_WIN
-          //! @todo remove
-            QString recentDir = KGlobalSettings::documentPath();
-            if (fname.isEmpty() && !projectData.constConnectionData()->dbFileName().isEmpty()) //propose filename from db template name
-              fname = KFileDialog::getStartURL(startDir, recentDir).path()
-                + '/' + projectData.constConnectionData()->dbFileName();
-            fname = Q3FileDialog::getSaveFileName(
-              KFileDialog::getStartURL(fname.isEmpty() ? startDir : fname, recentDir).path(),
-              KexiUtils::fileDialogFilterStrings(mimetypes, false),
-              this, "CreateProjectFromTemplate", caption);
-            if ( !fname.isEmpty() ) {
-              //save last visited path
-              KUrl url;
-              url.setPath( fname );
-              if (url.isLocalFile())
-                KRecentDirs::add(startDir, url.directory());
-            }
-        #else*/
         Q_UNUSED(projectData);
         if (fname.isEmpty() &&
                 !projectData.constConnectionData()->dbFileName().isEmpty()) {
@@ -1701,9 +1674,6 @@ tristate KexiMainWindow::createProjectFromTemplate(const KexiProjectData& projec
         dlg.setWindowTitle(caption);
         dlg.exec();
         fname = dlg.selectedFile();
-        if (!fname.isEmpty())
-            KRecentDocument::add(fname);
-//#endif
         if (fname.isEmpty())
             return cancelled;
         if (KexiStartupFileWidget::askForOverwriting(fname, this))
@@ -3386,12 +3356,12 @@ tristate KexiMainWindow::openProjectInExternalKexiInstance(const QString& aFileN
     return ok;
 }
 
-void KexiMainWindow::slotProjectOpenRecent()
+void KexiMainWindow::slotProjectWelcome()
 {
     if (!d->tabbedToolBar)
         return;
-    d->tabbedToolBar->showMainMenu("project_open_recent");
-    KexiRecentProjectsAssistant* assistant = new KexiRecentProjectsAssistant(
+    d->tabbedToolBar->showMainMenu("project_welcome");
+    KexiWelcomeAssistant* assistant = new KexiWelcomeAssistant(
         Kexi::recentProjects());
     connect(assistant, SIGNAL(openProject(KexiProjectData)), 
             this, SLOT(openProject(KexiProjectData)));
diff --git a/kexi/main/KexiMainWindow.h b/kexi/main/KexiMainWindow.h
index 0abb0f1..cbc1da3 100644
--- a/kexi/main/KexiMainWindow.h
+++ b/kexi/main/KexiMainWindow.h
@@ -592,9 +592,9 @@ protected slots:
     //! Only called on project opening and closing.
     void updateReadOnlyState();
 
+    void slotProjectWelcome();
     void slotProjectNew();
     void slotProjectOpen();
-    void slotProjectOpenRecent();
     void slotProjectSave();
     void slotProjectSaveAs();
     void slotProjectPrint();
diff --git a/kexi/main/KexiMainWindow_p.h b/kexi/main/KexiMainWindow_p.h
index 5837303..a3b2953 100644
--- a/kexi/main/KexiMainWindow_p.h
+++ b/kexi/main/KexiMainWindow_p.h
@@ -407,7 +407,7 @@ protected:
             topmargin += m_topLineHeight;
             m_menuWidget->setContentsMargins(leftmargin, topmargin, rightmargin, bottommargin);
 
-            m_menuWidget->addAction(ac->action("project_open_recent"));
+            m_menuWidget->addAction(ac->action("project_welcome"));
             m_menuWidget->addAction(ac->action("project_open"));
             //menu->addAction(new KexiMenuWidgetAction(KStandardAction::New, this));
             //menu->addAction(new KexiMenuWidgetAction(KStandardAction::Open, this));
@@ -1497,8 +1497,8 @@ public:
         action_view_nav = 0;
         action_view_propeditor = 0;
         action_view_mainarea = 0;
-        action_open_recent_projects_title_id = -1;
-        action_open_recent_connections_title_id = -1;
+        action_welcome_projects_title_id = -1;
+        action_welcome_connections_title_id = -1;
         forceWindowClosing = false;
         insideCloseWindow = false;
 #ifndef KEXI_NO_PENDING_DIALOGS
@@ -1932,18 +1932,17 @@ public:
     //! Kexi menu
     KAction *action_save, *action_save_as, 
     *action_project_import_export_send, *action_close,
-    *action_project_properties, *action_open_recent_more,
+    *action_project_properties,
     *action_project_relations, *action_project_import_data_table,
     *action_project_export_data_table;
 #ifndef KEXI_NO_QUICK_PRINTING
     KAction *action_project_print, *action_project_print_preview,
         *action_project_print_setup;
 #endif
-    KAction *action_open_recent;
+    KAction *action_project_welcome;
     KAction *action_show_other;
-//  int action_open_recent_more_id;
-    int action_open_recent_projects_title_id,
-    action_open_recent_connections_title_id;
+    int action_welcome_projects_title_id,
+    action_welcome_connections_title_id;
     KAction *action_settings;
 
     //! edit menu
diff --git a/kexi/main/startup/KexiRecentProjectsAssistant.cpp b/kexi/main/startup/KexiWelcomeAssistant.cpp
similarity index 81%
rename from kexi/main/startup/KexiRecentProjectsAssistant.cpp
rename to kexi/main/startup/KexiWelcomeAssistant.cpp
index d7861f8..34fcac6 100644
--- a/kexi/main/startup/KexiRecentProjectsAssistant.cpp
+++ b/kexi/main/startup/KexiWelcomeAssistant.cpp
@@ -17,7 +17,7 @@
  * Boston, MA 02110-1301, USA.
  */
 
-#include "KexiRecentProjectsAssistant.h"
+#include "KexiWelcomeAssistant.h"
 
 #include "KexiRecentProjectsModel.h"
 
@@ -57,9 +57,9 @@
 #include <QProgressBar>
 #include <QTimer>
  
-KexiMainRecentProjectsPage::KexiMainRecentProjectsPage(
-   KexiRecentProjectsAssistant* assistant, QWidget* parent)
- : KexiAssistantPage(i18n("Recent Projects"),
+KexiMainWelcomePage::KexiMainWelcomePage(
+   KexiWelcomeAssistant* assistant, QWidget* parent)
+ : KexiAssistantPage(i18n("Welcome to Kexi"),
                   i18n("Select one of the recently used projects to open."),
                   parent)
  , m_assistant(assistant)
@@ -82,7 +82,7 @@ KexiMainRecentProjectsPage::KexiMainRecentProjectsPage(
     QTimer::singleShot(100, this, SLOT(loadProjects()));
 }
 
-void KexiMainRecentProjectsPage::loadProjects()
+void KexiMainWelcomePage::loadProjects()
 {
     m_recentProjectsProxyModel = new KexiRecentProjectsProxyModel(m_recentProjects);
     KexiRecentProjectsModel* model = new KexiRecentProjectsModel(*m_assistant->projects());
@@ -91,7 +91,7 @@ void KexiMainRecentProjectsPage::loadProjects()
     m_recentProjectsProxyModel->sort(0, Qt::DescendingOrder);
 }
 
-void KexiMainRecentProjectsPage::slotItemClicked(const QModelIndex& index)
+void KexiMainWelcomePage::slotItemClicked(const QModelIndex& index)
 {
     if (!index.isValid())
         return;
@@ -111,10 +111,10 @@ void KexiMainRecentProjectsPage::slotItemClicked(const QModelIndex& index)
 
 // ----
 
-class KexiRecentProjectsAssistant::Private
+class KexiWelcomeAssistant::Private
 {
 public:
-    Private(KexiRecentProjectsAssistant *qq)
+    Private(KexiWelcomeAssistant *qq)
      : q(qq)
     {
     }
@@ -123,12 +123,12 @@ public:
     {
     }
     
-    KexiMainRecentProjectsPage* mainRecentProjectsPage() {
-        return page<KexiMainRecentProjectsPage>(&m_mainRecentProjectsPage, q);
+    KexiMainWelcomePage* mainWelcomePage() {
+        return page<KexiMainWelcomePage>(&m_mainWelcomePage, q);
     }
     
     template <class C>
-    C* page(QPointer<C>* p, KexiRecentProjectsAssistant *parent = 0) {
+    C* page(QPointer<C>* p, KexiWelcomeAssistant *parent = 0) {
         if (p->isNull()) {
             *p = new C(parent);
             q->addPage(*p);
@@ -136,7 +136,7 @@ public:
         return *p;
     }
 
-    QPointer<KexiMainRecentProjectsPage> m_mainRecentProjectsPage;
+    QPointer<KexiMainWelcomePage> m_mainWelcomePage;
     
     QAction* messageWidgetActionNo;
     QAction* messageWidgetActionTryAgain;
@@ -144,12 +144,12 @@ public:
 
     KexiRecentProjects* projects;
     
-    KexiRecentProjectsAssistant *q;
+    KexiWelcomeAssistant *q;
 };
 
 // ----
 
-KexiRecentProjectsAssistant::KexiRecentProjectsAssistant(
+KexiWelcomeAssistant::KexiWelcomeAssistant(
     KexiRecentProjects* projects, QWidget* parent)
  : KexiAssistantWidget(parent)
  , d(new Private(this))
@@ -157,23 +157,23 @@ KexiRecentProjectsAssistant::KexiRecentProjectsAssistant(
     d->messageWidgetActionNo = 0;
     d->messageWidgetActionTryAgain = 0;
     d->projects = projects;
-    setCurrentPage(d->mainRecentProjectsPage());
-    setFocusProxy(d->mainRecentProjectsPage());
+    setCurrentPage(d->mainWelcomePage());
+    setFocusProxy(d->mainWelcomePage());
 }
 
-KexiRecentProjectsAssistant::~KexiRecentProjectsAssistant()
+KexiWelcomeAssistant::~KexiWelcomeAssistant()
 {
     delete d;
 }
 
-void KexiRecentProjectsAssistant::previousPageRequested(KexiAssistantPage* page)
+void KexiWelcomeAssistant::previousPageRequested(KexiAssistantPage* page)
 {
     Q_UNUSED(page);
 }
 
-void KexiRecentProjectsAssistant::nextPageRequested(KexiAssistantPage* page)
+void KexiWelcomeAssistant::nextPageRequested(KexiAssistantPage* page)
 {
-    if (page == d->m_mainRecentProjectsPage) {
+    if (page == d->m_mainWelcomePage) {
         /*
         KexiDB::ConnectionData *cdata
             = d->projectConnectionSelectionPage()->connSelector->selectedConnectionData();
@@ -185,20 +185,20 @@ void KexiRecentProjectsAssistant::nextPageRequested(KexiAssistantPage* page)
     }
 }
 
-void KexiRecentProjectsAssistant::cancelRequested(KexiAssistantPage* page)
+void KexiWelcomeAssistant::cancelRequested(KexiAssistantPage* page)
 {
     Q_UNUSED(page);
     //TODO?
 }
 
-void KexiRecentProjectsAssistant::showErrorMessage(
+void KexiWelcomeAssistant::showErrorMessage(
     const QString &title, const QString &details)
 {
     Q_UNUSED(title);
     Q_UNUSED(details);
 }
 
-void KexiRecentProjectsAssistant::showErrorMessage(
+void KexiWelcomeAssistant::showErrorMessage(
     KexiDB::Object *obj, const QString& msg)
 {
     Q_UNUSED(obj);
@@ -242,14 +242,14 @@ void KexiRecentProjectsAssistant::showErrorMessage(
         b->mapToGlobal(QPoint(0, b->height() / 2)));*/
 }
 
-void KexiRecentProjectsAssistant::tryAgainActionTriggered()
+void KexiWelcomeAssistant::tryAgainActionTriggered()
 {
 //    d->m_projectConnectionSelectionPage->next();
 }
 
-KexiRecentProjects* KexiRecentProjectsAssistant::projects()
+KexiRecentProjects* KexiWelcomeAssistant::projects()
 {
     return d->projects;
 }
 
-#include "KexiRecentProjectsAssistant.moc"
+#include "KexiWelcomeAssistant.moc"
diff --git a/kexi/main/startup/KexiRecentProjectsAssistant.h b/kexi/main/startup/KexiWelcomeAssistant.h
similarity index 82%
rename from kexi/main/startup/KexiRecentProjectsAssistant.h
rename to kexi/main/startup/KexiWelcomeAssistant.h
index 70e7ca6..1f5af0d 100644
--- a/kexi/main/startup/KexiRecentProjectsAssistant.h
+++ b/kexi/main/startup/KexiWelcomeAssistant.h
@@ -17,8 +17,8 @@
  * Boston, MA 02110-1301, USA.
  */
 
-#ifndef KEXIRECENTPROJECTSASSISTANT_H
-#define KEXIRECENTPROJECTSASSISTANT_H
+#ifndef KEXIWELCOMEASSISTANT_H
+#define KEXIWELCOMEASSISTANT_H
 
 #include <kexidb/connectiondata.h>
 #include <kexidb/msghandler.h>
@@ -33,14 +33,14 @@ class KexiConnSelectorWidget;
 class KexiProjectData;
 class KexiProjectSelectorWidget;
 class KCategorizedView;
-class KexiRecentProjectsAssistant;
+class KexiWelcomeAssistant;
 class KexiRecentProjectsProxyModel;
 
-class KexiMainRecentProjectsPage : public KexiAssistantPage
+class KexiMainWelcomePage : public KexiAssistantPage
 {
     Q_OBJECT
 public:
-    explicit KexiMainRecentProjectsPage(KexiRecentProjectsAssistant* assistant,
+    explicit KexiMainWelcomePage(KexiWelcomeAssistant* assistant,
                                         QWidget* parent = 0);
 
     QString selectedTemplate;
@@ -55,19 +55,19 @@ private slots:
 private:
     KexiCategorizedView* m_recentProjects;
     KexiRecentProjectsProxyModel* m_recentProjectsProxyModel;
-    KexiRecentProjectsAssistant* m_assistant;
+    KexiWelcomeAssistant* m_assistant;
 };
 
 class KexiProjectData;
 class KexiRecentProjects;
 
-class KexiRecentProjectsAssistant : public KexiAssistantWidget,
-                                    public KexiDB::MessageHandler
+class KexiWelcomeAssistant : public KexiAssistantWidget,
+                             public KexiDB::MessageHandler
 {
     Q_OBJECT
 public:
-    explicit KexiRecentProjectsAssistant(KexiRecentProjects* projects, QWidget* parent = 0);
-    ~KexiRecentProjectsAssistant();
+    explicit KexiWelcomeAssistant(KexiRecentProjects* projects, QWidget* parent = 0);
+    ~KexiWelcomeAssistant();
 
     //! Implementation for KexiDB::MessageHandler.
     virtual void showErrorMessage(const QString &title,



More information about the kde-doc-english mailing list