kexi

KexiStartupDialog.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2003-2007 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 #include <core/kexiprojectdata.h>
00034 
00035 class KexiStartupDialogPrivate;
00036 class KexiProjectData;
00037 class KexiProjectSet;
00038 class KexiDBConnectionSet;
00039 class ConnectionDataLVItem;
00040 
00046 class KEXIMAIN_EXPORT KexiStartupDialog : public KDialogBase
00047 {
00048     Q_OBJECT
00049 
00050 public:
00060     enum Result { 
00061         CancelResult,             
00062         CreateBlankResult,        
00063         CreateFromTemplateResult, 
00064         ImportResult,             
00065         OpenExistingResult,       
00066         OpenRecentResult          
00067     };
00068 
00077     enum DialogType { Templates = 1, OpenExisting = 2, OpenRecent = 4, Everything = (1+2+4) };
00078 
00083     enum DialogOptions { CheckBoxDoNotShowAgain = 1 };
00084     
00094     KexiStartupDialog(
00095         int dialogType, 
00096         int dialogOptions,
00097         KexiDBConnectionSet& connSet,
00098         KexiProjectSet& recentProjects,
00099         QWidget *parent = 0, const char *name = 0 );
00100     ~KexiStartupDialog();
00101 
00104     static bool shouldBeShown();
00105 
00108     int result() const;
00109 
00113     KexiProjectData* selectedProjectData() const;
00114     
00121     QString selectedFileName() const;
00122 
00125     QValueList<KexiProjectData::ObjectInfo> autoopenObjects() const;
00126 
00131     KexiDB::ConnectionData* selectedExistingConnection() const;
00132 
00134     virtual void show();
00135 
00136 public slots:
00137 
00138 protected slots:
00139     virtual void done(int r);
00140     virtual void reject();
00141     virtual void slotOk();
00142     
00144     void slotPageShown(QWidget *page);
00145 /*
00147     void templateItemExecuted(QIconViewItem *item);
00148 
00150     void templateItemSelected(QIconViewItem *item);*/
00151 
00153     void tabShown(QWidget *w);
00154 
00155     void templateSelected(const QString& fileName);
00156 
00158     void recentProjectItemExecuted(KexiProjectData *data);
00159     void existingFileSelected(const QString &f);
00160     void showSimpleConnForOpenExisting();
00161     void showAdvancedConnForOpenExisting();
00162     void connectionItemForOpenExistingExecuted(ConnectionDataLVItem *item);
00163     void connectionItemForOpenExistingHighlighted(ConnectionDataLVItem *item);
00164 
00165 protected:
00166     virtual bool eventFilter( QObject *o, QEvent *e );
00167     
00169     void updateDialogOKButton(QWidget *w);
00170 
00172     int activePageIndex() const;
00173 private:
00174     void setupPageTemplates();
00175     void setupPageOpenExisting();
00176     void setupPageOpenRecent();
00177     
00179 //  void updateSelectedTemplateKeyInfo();
00180 
00181     KexiStartupDialogPrivate *d;
00182 };
00183 
00184 #endif
00185 
KDE Home | KDE Accessibility Home | Description of Access Keys