00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include "KexiStartupDialog.h"
00021
00022 #include "kexi.h"
00023 #include "KexiProjectSelector.h"
00024 #include "KexiOpenExistingFile.h"
00025 #include "KexiConnSelector.h"
00026 #include "KexiConnSelectorBase.h"
00027
00028 #include <qlayout.h>
00029 #include <qtabwidget.h>
00030 #include <qcombobox.h>
00031 #include <qcheckbox.h>
00032 #include <qpoint.h>
00033 #include <qobjectlist.h>
00034 #include <qvgroupbox.h>
00035 #include <qapplication.h>
00036 #include <qtooltip.h>
00037 #include <qwidgetstack.h>
00038
00039 #include <klocale.h>
00040 #include <kdeversion.h>
00041 #include <kinstance.h>
00042 #include <kdebug.h>
00043 #include <kpushbutton.h>
00044 #include <kjanuswidget.h>
00045 #include <kglobalsettings.h>
00046 #include <ktextedit.h>
00047 #include <kfileiconview.h>
00048 #include <kfileitem.h>
00049 #include <kmessagebox.h>
00050 #include <kapplication.h>
00051 #include <kmimetype.h>
00052 #include <ktextbrowser.h>
00053 #include <kconfig.h>
00054
00056 #define NO_DB_TEMPLATES
00057
00058 #ifdef KEXI_SHOW_UNIMPLEMENTED
00059 #define KEXI_STARTUP_SHOW_TEMPLATES
00060 #define KEXI_STARTUP_SHOW_RECENT
00061 #endif
00062
00063 class TemplateItem : public KIconViewItem
00064 {
00065 public:
00066 TemplateItem(KIconView* parent, const QString& name, const QPixmap& icon)
00067 : KIconViewItem(parent,name,icon)
00068 {}
00069 ~TemplateItem() {}
00070 QString key, name, description;
00071 };
00072
00073 TemplatesPage::TemplatesPage( Orientation o, QWidget * parent, const char * name )
00074 : QSplitter(o, parent, name)
00075 {
00076 templates = new KIconView(this, "templates");
00077 templates->setItemsMovable(false);
00078 templates->setShowToolTips(false);
00079 info = new KTextBrowser(this,"info");
00080 setResizeMode(templates,KeepSize);
00081 setResizeMode(info,KeepSize);
00082
00083 connect(templates,SIGNAL(selectionChanged(QIconViewItem*)),this,SLOT(itemClicked(QIconViewItem*)));
00084 }
00085
00086 TemplatesPage::~TemplatesPage() {}
00087
00088 void TemplatesPage::addItem(const QString& key, const QString& name,
00089 const QString& description, const QPixmap& icon)
00090 {
00091 TemplateItem *item = new TemplateItem(templates, name, icon);
00092 item->key=key;
00093 item->name=name;
00094 item->description=description;
00095 }
00096
00097 void TemplatesPage::itemClicked(QIconViewItem *item) {
00098 if (!item) {
00099 info->setText("");
00100 return;
00101 }
00102 QString t = QString("<h2>%1</h2><p>%2</p>")
00103 .arg(static_cast<TemplateItem*>(item)->name)
00104 .arg(static_cast<TemplateItem*>(item)->description);
00105 #ifdef NO_DB_TEMPLATES
00106 t += QString("<p>") + i18n("We are sorry, templates are not yet available.") +"</p>";
00107 #endif
00108
00109 info->setText( t );
00110 }
00111
00112
00113
00115 class KexiStartupDialogPrivate {
00116 public:
00117 KexiStartupDialogPrivate()
00118 : pageTemplates(0), pageOpenExisting(0), pageOpenRecent(0)
00119 , pageTemplatesID(-1)
00120 , pageOpenExistingID(-1)
00121 , pageOpenRecentID(-1)
00122 {
00123 result = 0;
00124 QString none, iconname;
00125 iconname = KMimeType::mimeType( KexiDB::Driver::defaultFileBasedDriverMimeType() )->icon(none,0);
00126 kexi_sqlite_icon = KGlobal::iconLoader()->loadIcon( iconname, KIcon::Desktop );
00127 iconname = KMimeType::mimeType("application/x-kexiproject-shortcut")->icon(none,0);
00128 kexi_shortcut_icon = KGlobal::iconLoader()->loadIcon( iconname, KIcon::Desktop );
00129 prj_selector = 0;
00130 chkDoNotShow = 0;
00131 openExistingConnWidget = 0;
00132 templatesWidget = 0;
00133 templatesWidget_IconListBox = 0;
00134 }
00135 ~KexiStartupDialogPrivate()
00136 {}
00137
00138 int dialogType, dialogOptions;
00139
00140 QFrame *pageTemplates, *pageOpenExisting, *pageOpenRecent;
00141 int pageTemplatesID;
00142 int pageOpenExistingID, pageOpenRecentID;
00143 int templatesSectionID_blank, templatesSectionID_import;
00144 #ifdef NO_DB_TEMPLATES
00145 int templatesSectionID_custom1, templatesSectionID_custom2;
00146 #endif
00147 QCheckBox *chkDoNotShow;
00148
00149
00150 KJanusWidget* templatesWidget;
00151 QObject *templatesWidget_IconListBox;
00152
00153 QWidgetStack *viewBlankTempl;
00154 TemplatesPage *viewPersonalTempl;
00155 TemplatesPage *viewBusinessTempl;
00156
00157 int result;
00158
00159 QPixmap kexi_sqlite_icon, kexi_shortcut_icon;
00160
00162 QString selectedTemplateKey;
00163
00165 KexiDBConnectionSet *connSet;
00166 KexiStartupFileDialog *openExistingFileDlg;
00167 KexiConnSelectorWidget *openExistingConnWidget;
00168 QString existingFileToOpen;
00169 KexiDB::ConnectionData* selectedExistingConnection;
00170
00172 KexiProjectSet *recentProjects;
00173 KexiProjectSelectorWidget* prj_selector;
00174
00176 bool singlePage : 1;
00177 };
00178
00179 bool dlgSinglePage(int type)
00180 {
00181 return (type==KexiStartupDialog::Templates)
00182 || (type==KexiStartupDialog::OpenExisting)
00183 || (type==KexiStartupDialog::OpenRecent);
00184 }
00185
00186 QString captionForDialogType(int type)
00187 {
00188 if (type==KexiStartupDialog::Templates)
00189 return i18n("Create Project");
00190 else if (type==KexiStartupDialog::OpenExisting)
00191 return i18n("Open Existing Project");
00192 else if (type==KexiStartupDialog::OpenRecent)
00193 return i18n("Open Recent Project");
00194
00195 return i18n("Choose Project");
00196 }
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206 KexiStartupDialog::KexiStartupDialog(
00207 int dialogType, int dialogOptions,
00208 KexiDBConnectionSet& connSet, KexiProjectSet& recentProjects,
00209 QWidget *parent, const char *name )
00210 : KDialogBase(
00211 dlgSinglePage(dialogType) ? Plain : Tabbed
00212 ,captionForDialogType(dialogType)
00213 ,Help | Ok | Cancel, Ok, parent, name )
00214 , d(new KexiStartupDialogPrivate())
00215 {
00216 d->recentProjects = &recentProjects;
00217 d->connSet = &connSet;
00218 d->dialogType = dialogType;
00219 d->dialogOptions = dialogOptions;
00220 d->singlePage = dlgSinglePage(dialogType);
00221
00222 if (dialogType==OpenExisting) {
00223 setIcon(DesktopIcon("fileopen"));
00224 } else {
00225 setIcon(d->kexi_sqlite_icon);
00226 }
00227
00228 setSizeGripEnabled(true);
00229 int id=0;
00230 if (d->dialogType & Templates) {
00231 setupPageTemplates();
00232 d->pageTemplatesID = id++;
00233 d->templatesWidget->setFocus();
00234 }
00235 if (d->dialogType & OpenExisting) {
00236 setupPageOpenExisting();
00237 d->pageOpenExistingID = id++;
00238 if (d->singlePage)
00239 d->openExistingConnWidget->setFocus();
00240 }
00241 #ifdef KEXI_STARTUP_SHOW_RECENT
00242 if (d->dialogType & OpenRecent) {
00243 setupPageOpenRecent();
00244 d->pageOpenRecentID = id++;
00245 if (d->singlePage)
00246 d->prj_selector->setFocus();
00247 }
00248 #endif
00249
00250 if (!d->singlePage) {
00251 connect(this, SIGNAL(aboutToShowPage(QWidget*)), this, SLOT(tabShown(QWidget*)));
00252 d->templatesWidget->setFocus();
00253 }
00254 showPage(0);
00255 adjustSize();
00256 }
00257
00258 KexiStartupDialog::~KexiStartupDialog()
00259 {
00260 delete d;
00261 }
00262
00263 bool KexiStartupDialog::shouldBeShown()
00264 {
00265 KGlobal::config()->setGroup("Startup");
00266 return KGlobal::config()->readBoolEntry("ShowStartupDialog",true);
00267 }
00268
00269 void KexiStartupDialog::show()
00270 {
00271
00272 d->selectedTemplateKey=QString::null;
00273 d->existingFileToOpen=QString::null;
00274 d->result=-1;
00275
00276 KDialog::centerOnScreen(this);
00277 KDialogBase::show();
00278 }
00279
00280 int KexiStartupDialog::result() const
00281 {
00282 return d->result;
00283 }
00284
00285 void KexiStartupDialog::done(int r)
00286 {
00287 if (d->result!=-1)
00288 return;
00289
00290
00291 updateSelectedTemplateKeyInfo();
00292
00293 if (r==QDialog::Rejected) {
00294 d->result = CancelResult;
00295 } else {
00296 const int idx = activePageIndex();
00297 if (idx == d->pageTemplatesID) {
00298 d->result = TemplateResult;
00299 }
00300 else if (idx == d->pageOpenExistingID) {
00301
00302 if (d->openExistingConnWidget->selectedConnectionType()==KexiConnSelectorWidget::FileBased) {
00303 if (!d->openExistingFileDlg->checkFileName())
00304 return;
00305 d->existingFileToOpen = d->openExistingFileDlg->currentFileName();
00306
00307 d->selectedExistingConnection = 0;
00308 } else {
00309 d->existingFileToOpen = QString::null;
00310 d->selectedExistingConnection
00311 = d->openExistingConnWidget->selectedConnectionData();
00312 }
00313 d->result = OpenExistingResult;
00314 }
00315 else {
00316 d->result = OpenRecentResult;
00317 }
00318 }
00319
00320
00321 KGlobal::config()->setGroup("Startup");
00322 if (d->openExistingConnWidget)
00323 KGlobal::config()->writeEntry("OpenExistingType",
00324 (d->openExistingConnWidget->selectedConnectionType() == KexiConnSelectorWidget::FileBased)
00325 ? "File" : "Server");
00326 if (d->chkDoNotShow)
00327 KGlobal::config()->writeEntry("ShowStartupDialog",!d->chkDoNotShow->isChecked());
00328
00329 KGlobal::config()->sync();
00330
00331 KDialogBase::done(r);
00332 }
00333
00334 void KexiStartupDialog::reject()
00335 {
00336
00337 KDialogBase::reject();
00338 }
00339
00340 void KexiStartupDialog::setupPageTemplates()
00341 {
00342 d->pageTemplates = addPage( i18n("&Create Project") );
00343 QVBoxLayout *lyr = new QVBoxLayout( d->pageTemplates, 0, KDialogBase::spacingHint() );
00344
00345 d->templatesWidget = new KJanusWidget(
00346 d->pageTemplates, "templatesWidget", KJanusWidget::IconList);
00347 {
00348 d->templatesWidget_IconListBox = d->templatesWidget->child(0,"KListBox");
00349 if (d->templatesWidget_IconListBox)
00350 d->templatesWidget_IconListBox->installEventFilter(this);
00351 }
00352 lyr->addWidget(d->templatesWidget);
00353 connect(d->templatesWidget, SIGNAL(aboutToShowPage(QWidget*)), this, SLOT(templatesPageShown(QWidget*)));
00354
00355 if (d->dialogOptions & CheckBoxDoNotShowAgain) {
00356 d->chkDoNotShow = new QCheckBox(i18n("Don't show me this dialog again"), d->pageTemplates, "chkDoNotShow");
00357 lyr->addWidget(d->chkDoNotShow);
00358 }
00359
00360
00361 QFrame *templPageFrame;
00362 QVBoxLayout *tmplyr;
00363 QLabel *lbl_blank;
00364 int itemID = 0;
00365
00366
00367 d->templatesSectionID_blank = itemID++;
00368 QString clickMsg( "\n\n" + i18n("Click \"OK\" button to proceed.") );
00369 templPageFrame = d->templatesWidget->addPage(
00370 i18n("Blank Database"), i18n("New Blank Database Project"), DesktopIcon("empty") );
00371 tmplyr = new QVBoxLayout(templPageFrame, 0, KDialogBase::spacingHint());
00372 lbl_blank = new QLabel(
00373 i18n("Kexi will create a new blank database project.")+clickMsg, templPageFrame );
00374 lbl_blank->setAlignment(Qt::AlignAuto|Qt::AlignTop|Qt::WordBreak);
00375 lbl_blank->setMargin(0);
00376 tmplyr->addWidget( lbl_blank );
00377 tmplyr->addStretch(1);
00378
00379
00380 d->templatesSectionID_import = itemID++;
00381 templPageFrame = d->templatesWidget->addPage(
00382 i18n("Import Existing\nDatabase"), i18n("Import Existing Database as New Database Project"),
00383 DesktopIcon("database_import") );
00384 tmplyr = new QVBoxLayout(templPageFrame, 0, KDialogBase::spacingHint());
00385 lbl_blank = new QLabel(
00386 i18n("Kexi will import the structure and data of an existing database as a new database project.")
00387 +clickMsg, templPageFrame );
00388 lbl_blank->setAlignment(Qt::AlignAuto|Qt::AlignTop|Qt::WordBreak);
00389 lbl_blank->setMargin(0);
00390 tmplyr->addWidget( lbl_blank );
00391 tmplyr->addStretch(1);
00392
00393 #ifdef KEXI_STARTUP_SHOW_TEMPLATES
00394
00395 d->templatesSectionID_custom1 = itemID++;
00396
00397
00398
00399
00400
00401
00402
00403
00404
00405
00406
00407
00408 d->templatesSectionID_custom2 = itemID++;
00409
00410
00411
00412
00413
00414
00415
00416
00417
00418
00419
00420 #endif //KEXI_STARTUP_SHOW_TEMPLATES
00421 }
00422
00423 void KexiStartupDialog::templatesPageShown(QWidget *page)
00424 {
00425 int idx = d->templatesWidget->pageIndex(page);
00426
00427 if (idx==d->templatesSectionID_blank) {
00428
00429 }
00430 else if (idx==d->templatesSectionID_import) {
00431 }
00432 #ifdef KEXI_STARTUP_SHOW_TEMPLATES
00433 else if (idx==d->templatesSectionID_custom1) {
00434 templ = d->viewPersonalTempl->templates;
00435 if (templ->count()==0) {
00436
00437 d->viewPersonalTempl->addItem("cd_catalog", i18n("CD Catalog"),
00438 i18n("Easy-to-use database for storing information about your CD collection."),
00439 DesktopIcon("cdrom_unmount"));
00440 d->viewPersonalTempl->addItem("expenses", i18n("Expenses"),
00441 i18n("A database for managing your personal expenses."),
00442 DesktopIcon("kcalc"));
00443 d->viewPersonalTempl->addItem("image_gallery", i18n("Image Gallery"),
00444 i18n("A database for archiving your image collection in a form of gallery."),
00445 DesktopIcon("icons"));
00446 }
00447 }
00448 else if (idx==d->templatesSectionID_custom2) {
00449 templ = d->viewBusinessTempl->templates;
00450 if (templ->count()==0) {
00451
00452 d->viewBusinessTempl->addItem("address_book", i18n("Address Book"),
00453 i18n("A database that offers you a contact information"),
00454 DesktopIcon("contents"));
00455 }
00456 }
00457 #endif
00458 updateDialogOKButton(d->pageTemplates);
00459 }
00460
00461 void KexiStartupDialog::templateItemSelected(QIconViewItem *)
00462 {
00463 updateDialogOKButton(d->pageTemplates);
00464 }
00465
00466 void KexiStartupDialog::templateItemExecuted(QIconViewItem *item)
00467 {
00468 if (!item)
00469 return;
00470 updateSelectedTemplateKeyInfo();
00471 #ifndef NO_DB_TEMPLATES
00472 accept();
00473 #endif
00474 }
00475
00476 void KexiStartupDialog::updateSelectedTemplateKeyInfo()
00477 {
00478 if (activePageIndex()!=d->pageTemplatesID) {
00479 d->selectedTemplateKey=QString::null;
00480 return;
00481 }
00482 QIconViewItem *item;
00483 if (d->templatesWidget->activePageIndex()==d->templatesSectionID_blank) {
00484 d->selectedTemplateKey = "blank";
00485 }
00486 else if (d->templatesWidget->activePageIndex()==d->templatesSectionID_import) {
00487 d->selectedTemplateKey = "import";
00488 }
00489 #ifdef NO_DB_TEMPLATES
00490 else if (d->templatesWidget->activePageIndex()==d->templatesSectionID_custom1) {
00491 item = d->viewPersonalTempl->templates->currentItem();
00492 if (!item) {
00493 d->selectedTemplateKey=QString::null;
00494 return;
00495 }
00496 d->selectedTemplateKey=QString("personal/")+static_cast<TemplateItem*>(item)->key;
00497 }
00498 else if (d->templatesWidget->activePageIndex()==d->templatesSectionID_custom2) {
00499 item = d->viewBusinessTempl->templates->currentItem();
00500 if (!item) {
00501 d->selectedTemplateKey=QString::null;
00502 return;
00503 }
00504 d->selectedTemplateKey=QString("business/")+static_cast<TemplateItem*>(item)->key;
00505 }
00506 #endif
00507 }
00508
00509 void KexiStartupDialog::tabShown(QWidget *w)
00510 {
00511
00512
00513 updateDialogOKButton(w);
00514
00515 if (w==d->pageOpenExisting) {
00516 d->openExistingConnWidget->setFocus();
00517 }
00518 }
00519
00520 void KexiStartupDialog::updateDialogOKButton(QWidget *w)
00521 {
00522 if (!w) {
00523 int idx = activePageIndex();
00524 if (idx==d->pageTemplatesID)
00525 w = d->pageTemplates;
00526 else if (idx==d->pageOpenExistingID)
00527 w = d->pageOpenExisting;
00528 else if (idx==d->pageOpenRecentID)
00529 w = d->pageOpenRecent;
00530
00531 if (!w)
00532 return;
00533 }
00534 bool enable = true;
00535 if (w==d->pageTemplates) {
00536 int t_id = d->templatesWidget->activePageIndex();
00537 #ifdef NO_DB_TEMPLATES
00538 enable = (t_id==d->templatesSectionID_blank || d->templatesSectionID_import);
00539 #else
00540 enable = (t_id==d->templatesSectionID_blank || d->templatesSectionID_import
00541 || (t_id==d->templatesSectionID_custom1 && d->viewPersonalTempl->templates->currentItem()!=0)
00542 || (t_id==d->templatesSectionID_custom1 && d->viewBusinessTempl->templates->currentItem()!=0));
00543 #endif
00544 }
00545 else if (w==d->pageOpenExisting) {
00546
00547 enable =
00548 (d->openExistingConnWidget->selectedConnectionType()==KexiConnSelectorWidget::FileBased)
00549 ? !d->openExistingFileDlg->currentFileName().isEmpty()
00550 : (bool)d->openExistingConnWidget->selectedConnectionData();
00551 }
00552 else if (w==d->pageOpenRecent) {
00553 enable = (d->prj_selector->selectedProjectData()!=0);
00554 }
00555 enableButton(Ok,enable);
00556 }
00557
00558 QString KexiStartupDialog::selectedTemplateKey() const
00559 {
00560 return d->selectedTemplateKey;
00561 }
00562
00563 void KexiStartupDialog::setupPageOpenExisting()
00564 {
00565 if (d->singlePage)
00566 d->pageOpenExisting = plainPage();
00567 else
00568 d->pageOpenExisting = addPage( i18n("Open &Existing Project") );
00569 QVBoxLayout *lyr = new QVBoxLayout( d->pageOpenExisting, 0, KDialogBase::spacingHint() );
00570
00571 d->openExistingConnWidget = new KexiConnSelectorWidget(*d->connSet,
00572 ":OpenExistingOrCreateNewProject",
00573 d->pageOpenExisting, "KexiConnSelectorWidget");
00574 d->openExistingConnWidget->hideConnectonIcon();
00575 lyr->addWidget( d->openExistingConnWidget );
00576 if (KGlobal::config()->readEntry("OpenExistingType","File")=="File")
00577 d->openExistingConnWidget->showSimpleConn();
00578 else {
00579 d->openExistingConnWidget->showSimpleConn();
00580 d->openExistingConnWidget->showAdvancedConn();
00581 }
00582 d->openExistingFileDlg = d->openExistingConnWidget->m_fileDlg;
00583 connect(d->openExistingFileDlg,SIGNAL(accepted()),this,SLOT(accept()));
00584 connect(d->openExistingConnWidget,SIGNAL(connectionItemExecuted(ConnectionDataLVItem*)),
00585 this,SLOT(connectionItemForOpenExistingExecuted(ConnectionDataLVItem*)));
00586 connect(d->openExistingConnWidget,SIGNAL(connectionItemHighlighted(ConnectionDataLVItem*)),
00587 this,SLOT(connectionItemForOpenExistingHighlighted(ConnectionDataLVItem*)));
00588 }
00589
00590 void KexiStartupDialog::connectionItemForOpenExistingExecuted(ConnectionDataLVItem *item)
00591 {
00592 if (!item)
00593 return;
00594 accept();
00595 }
00596
00597 void KexiStartupDialog::connectionItemForOpenExistingHighlighted(ConnectionDataLVItem *item)
00598 {
00599 actionButton(KDialogBase::Ok)->setEnabled(item);
00600 }
00601
00602 void KexiStartupDialog::slotOk() {
00603
00604 if (activePageIndex()==d->pageOpenExistingID) {
00605 if (d->openExistingFileDlg) {
00606 if (d->openExistingFileDlg->okButton())
00607 d->openExistingFileDlg->okButton()->animateClick();
00608
00609 }
00610 }
00611 KDialogBase::slotOk();
00612 }
00613
00614 void KexiStartupDialog::showSimpleConnForOpenExisting()
00615 {
00616
00617 d->openExistingConnWidget->showSimpleConn();
00618 }
00619
00620 void KexiStartupDialog::showAdvancedConnForOpenExisting()
00621 {
00622
00623 d->openExistingConnWidget->showAdvancedConn();
00624 }
00625
00626 QString KexiStartupDialog::selectedExistingFile() const
00627 {
00628
00629
00630 return d->existingFileToOpen;
00631 }
00632
00633 KexiDB::ConnectionData* KexiStartupDialog::selectedExistingConnection() const
00634 {
00635 return d->selectedExistingConnection;
00636 }
00637
00638 void KexiStartupDialog::existingFileSelected(const QString &f)
00639 {
00640 if (f.isEmpty())
00641 return;
00642 d->existingFileToOpen=f;
00643 updateDialogOKButton(d->openExistingFileDlg);
00644 }
00645
00646 void KexiStartupDialog::setupPageOpenRecent()
00647 {
00648 #ifdef KEXI_STARTUP_SHOW_RECENT
00649 d->pageOpenRecent = addPage( i18n("Open &Recent Project") );
00650 QVBoxLayout *lyr = new QVBoxLayout( d->pageOpenRecent, 0, KDialogBase::spacingHint() );
00651 lyr->addWidget( d->prj_selector = new KexiProjectSelectorWidget(
00652 d->pageOpenRecent, "prj_selector", d->recentProjects ) );
00653 connect(d->prj_selector,SIGNAL(projectExecuted(KexiProjectData*)),
00654 this,SLOT(recentProjectItemExecuted(KexiProjectData*)));
00655 #endif
00656 }
00657
00658 KexiProjectData* KexiStartupDialog::selectedProjectData() const
00659 {
00660 if (activePageIndex()==d->pageOpenRecentID) {
00661 return d->prj_selector->selectedProjectData();
00662 }
00663 return 0;
00664 }
00665
00666 void KexiStartupDialog::recentProjectItemExecuted(KexiProjectData *data)
00667 {
00668 updateDialogOKButton(d->pageOpenRecent);
00669 if (!data)
00670 return;
00671 accept();
00672 }
00673
00675 bool KexiStartupDialog::eventFilter( QObject *o, QEvent *e )
00676 {
00677 if (o==d->templatesWidget_IconListBox && d->templatesWidget_IconListBox) {
00678 if (e->type()==QEvent::KeyPress
00679 && (static_cast<QKeyEvent*>(e)->key()==Key_Enter || static_cast<QKeyEvent*>(e)->key()==Key_Return)
00680 || e->type()==QEvent::MouseButtonDblClick)
00681 {
00682 const int t_id = d->templatesWidget->activePageIndex();
00683 if (t_id==d->templatesSectionID_blank || t_id==d->templatesSectionID_import) {
00684 accept();
00685 }
00686 }
00687 }
00688 return KDialogBase::eventFilter(o,e);
00689 }
00690
00691
00692 int KexiStartupDialog::activePageIndex() const
00693 {
00694 if (!d->singlePage) {
00695
00696 return KDialogBase::activePageIndex();
00697 }
00698 kdDebug() << "int KexiStartupDialog::activePageIndex() == " << 0 << endl;
00699 return 0;
00700 }
00701
00702 #include "KexiStartupDialog.moc"