--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/contentstorage/caclient/tsrc/t_testapp/main.cpp Thu Sep 16 12:11:40 2010 +0100
@@ -0,0 +1,104 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include <QtGui>
+#include <QStandardItemModel>
+
+#include <hbapplication.h>
+#include <hbmainwindow.h>
+#include <hbmenu.h>
+#include <hbview.h>
+#include <hbmainwindow.h>
+#include <hbaction.h>
+#include <hbgridview.h>
+
+#include "caservice.h"
+#include "caentry.h"
+#include "caquery.h"
+
+QStandardItemModel *populateModel()
+{
+ QStandardItemModel *result = new QStandardItemModel();
+
+
+ QList<QStandardItem *> items;
+
+ for (int i = 0; i < 10; ++i) {
+ //items << new QStandardItem(QString("Item %1").arg(i+1));
+ }
+ QSharedPointer<CaService> service = CaService::instance();
+
+ //QList<CaEntry*> entryList = service->getEntries(QList<int>() << 1 << 3 << 4);
+ CaQuery query;
+ query.setParentId(2);
+ QList< QSharedPointer<CaEntry> > entryList = service->getEntries(query);
+ foreach(QSharedPointer<CaEntry> entry, entryList) {
+ items << new QStandardItem(entry->makeIcon(), entry->text());
+ }
+ result->appendColumn(items);
+
+ return result;
+}
+
+
+int main(int argc, char *argv[])
+{
+ // Each Orbit UI application needs to instantiate HbApplication.
+ // It is the core part of an Orbit UI application.
+ // Note: HbApplication is a specialisation of Qt's QApplication
+ // so your Orbit application does not need to instantiate a
+ // QApplication as well.
+ HbApplication app(argc, argv);
+
+ // HbMainWindow contains all your application's screen elements
+ // such as widgets and views.
+ // Also, the decorators that make up the standard Orbit UI style
+ // (e.g. indicators, softkeys, menus) are automatically created
+ // when this class is instantiated.
+ HbMainWindow mainWindow;
+
+
+
+ HbGridView *grid = new HbGridView();
+ grid->setParent(&app);
+
+ //QStandardItemModel* model = populateModel;
+ grid->setModel(populateModel());
+
+ HbView *view = new HbView();
+ view->setParent(&app);
+ view->setTitle("Test CA app");
+ view->setWidget(grid);
+
+ // Add the label widget to the HbMainWindow as a view.
+ mainWindow.addView(view);
+
+ HbMenu *menu = new HbMenu();
+ menu->addAction(QString("Exit application"), qApp, SLOT(quit()));
+ mainWindow.currentView()->setMenu(menu);
+
+ // Show the current view. There is only one view which happens to contain
+ // only a single widget, i.e. the label with the "Hello World" text, so
+ // that is what will be shown.
+ mainWindow.show();
+
+ // Start the standard Qt application event processing loop.
+ // In this application the only possible user interaction is to
+ // press the "back" button that was automatically added to
+ // the HbMainWindow.
+ return app.exec();
+}