20#include "KexiStartupDialogTemplatesPage.h"
23#include <core/kexitemplateloader.h>
24#include "KexiProjectSelector.h"
25#include "KexiOpenExistingFile.h"
26#include "KexiConnSelector.h"
27#include "KexiConnSelectorBase.h"
32#include <kiconloader.h>
34#ifdef KEXI_SHOW_UNIMPLEMENTED
35#define KEXI_STARTUP_SHOW_TEMPLATES
36#define KEXI_STARTUP_SHOW_RECENT
52class TemplateItem :
public TDEListViewItem
55 TemplateItem(TQListView* parent,
const TQString& aFilename,
56 const TQString& name,
const TQString& description,
const TQPixmap& icon,
57 const TQValueList<KexiProjectData::ObjectInfo>& aAutoopenObjects)
58 : TDEListViewItem(parent, name +
"\n" + description)
59 , autoopenObjects(aAutoopenObjects)
66 TQValueList<KexiProjectData::ObjectInfo> autoopenObjects;
72KexiStartupDialogTemplatesPage::KexiStartupDialogTemplatesPage( TQWidget * parent )
73 : TDEListView(parent,
"KexiStartupDialogTemplatesPage")
76 addColumn(TQString());
78 setColumnWidthMode(0, Maximum);
79 setResizeMode(LastColumn);
81 connect(
this,TQ_SIGNAL(executed(TQListViewItem*)),
this, TQ_SLOT(slotExecuted(TQListViewItem*)));
84KexiStartupDialogTemplatesPage::~KexiStartupDialogTemplatesPage()
88void KexiStartupDialogTemplatesPage::populate()
93 KexiTemplateInfo::List list = KexiTemplateLoader::loadListInfo();
94 foreach( TQValueList<KexiTemplateInfo>::ConstIterator, it, list ) {
95 new TemplateItem(
this, (*it).filename, (*it).name,
96 (*it).description, (*it).icon, (*it).autoopenObjects);
99 setSelected(firstChild(),
true);
135TQString KexiStartupDialogTemplatesPage::selectedFileName()
const
137 TemplateItem* templateItem =
static_cast<TemplateItem*
>(selectedItem());
138 return templateItem ? templateItem->filename : TQString();
141TQValueList<KexiProjectData::ObjectInfo>
142KexiStartupDialogTemplatesPage::autoopenObjectsForSelectedTemplate()
const
144 TemplateItem* templateItem =
static_cast<TemplateItem*
>(selectedItem());
145 return templateItem ? templateItem->autoopenObjects : TQValueList<KexiProjectData::ObjectInfo>();
148void KexiStartupDialogTemplatesPage::slotExecuted(TQListViewItem* item)
150 TemplateItem* templateItem =
static_cast<TemplateItem*
>(item);
154 emit selected(templateItem->filename);
157#include "KexiStartupDialogTemplatesPage.moc"