kexi

KexiStartupDialog.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2003 Jaroslaw Staniek <js@iidea.pl>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License as published by the Free Software Foundation; either
00007    version 2 of the License, or (at your option) any later version.
00008 
00009    This library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  If not, write to
00016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, USA.
00018  */
00019 
00020 #ifndef KexiStartupDialog_h
00021 #define KexiStartupDialog_h
00022 
00023 #include <kdialogbase.h>
00024 #include <kicondialog.h>
00025 #include <kiconview.h>
00026 #include <kfileiconview.h>
00027 #include <kfiledialog.h>
00028 
00029 #include <qlabel.h>
00030 #include <qsplitter.h>
00031 
00032 #include <kexidb/connectiondata.h>
00033 
00034 class KTextBrowser;
00035 
00037 class KEXIMAIN_EXPORT TemplatesPage : public QSplitter
00038 {
00039     Q_OBJECT
00040     
00041     public:
00042         TemplatesPage( Orientation o, QWidget * parent = 0, const char * name = 0 );
00043         ~TemplatesPage(); 
00044         void addItem(const QString& key, const QString& name, 
00045             const QString& description, const QPixmap& icon);
00046     private slots:
00047         void itemClicked(QIconViewItem *item);
00048     
00049     public:
00050         KIconView *templates;
00051         KTextBrowser *info;
00052 };
00053 
00054 
00055 class KexiStartupDialogPrivate;
00056 class KexiProjectData;
00057 class KexiProjectSet;
00058 class KexiDBConnectionSet;
00059 class ConnectionDataLVItem;
00060 
00066 class KEXIMAIN_EXPORT KexiStartupDialog : public KDialogBase
00067 {
00068     Q_OBJECT
00069 
00070 public:
00078     enum Result { CancelResult=0, TemplateResult=1, OpenExistingResult=2, OpenRecentResult=3 };
00087     enum DialogType { Templates = 1, OpenExisting = 2, OpenRecent = 4, Everything = (1+2+4) };
00088 
00093     enum DialogOptions { CheckBoxDoNotShowAgain = 1 };
00094     
00104     KexiStartupDialog(
00105         int dialogType, 
00106         int dialogOptions,
00107         KexiDBConnectionSet& connSet,
00108         KexiProjectSet& recentProjects,
00109         QWidget *parent = 0, const char *name = 0 );
00110     ~KexiStartupDialog();
00111 
00114     static bool shouldBeShown();
00115 
00118     int result() const;
00119 
00125     QString selectedTemplateKey() const;
00126 
00130     KexiProjectData* selectedProjectData() const;
00131     
00136     QString selectedExistingFile() const;
00137 
00142     KexiDB::ConnectionData* selectedExistingConnection() const;
00143 
00145     virtual void show();
00146 
00147 public slots:
00148 
00149 protected slots:
00150     virtual void done(int r);
00151     virtual void reject();
00152     virtual void slotOk();
00153     
00155     void templatesPageShown(QWidget *page);
00156 
00158     void templateItemExecuted(QIconViewItem *item);
00159 
00161     void templateItemSelected(QIconViewItem *item);
00162 
00164     void tabShown(QWidget *w);
00165 
00167     void recentProjectItemExecuted(KexiProjectData *data);
00168     void existingFileSelected(const QString &f);
00169     void showSimpleConnForOpenExisting();
00170     void showAdvancedConnForOpenExisting();
00171     void connectionItemForOpenExistingExecuted(ConnectionDataLVItem *item);
00172     void connectionItemForOpenExistingHighlighted(ConnectionDataLVItem *item);
00173 
00174 protected:
00175     virtual bool eventFilter( QObject *o, QEvent *e );
00176     
00178     void updateDialogOKButton(QWidget *w);
00179 
00181     int activePageIndex() const;
00182 private:
00183     void setupPageTemplates();
00184     void setupPageOpenExisting();
00185     void setupPageOpenRecent();
00186     
00188     void updateSelectedTemplateKeyInfo();
00189 
00190     KexiStartupDialogPrivate *d;
00191 };
00192 
00193 #endif
00194 
KDE Home | KDE Accessibility Home | Description of Access Keys