first release
[groupsms] / sms / main.cpp
diff --git a/sms/main.cpp b/sms/main.cpp
new file mode 100644 (file)
index 0000000..5b0df3d
--- /dev/null
@@ -0,0 +1,56 @@
+#include <QtGui/QApplication>
+#include "mainwindow.h"
+#include "contactinterface.h"
+#include "common.h"
+#include "item.h"
+
+#ifdef ONLY_FOR_EBOOK
+
+#include <gtk/gtk.h>
+
+#endif
+
+static void registerTypes()
+{
+    static bool registered = false;
+    if( !registered )
+    {
+        qRegisterMetaType<Item>();
+        qRegisterMetaType<ItemList>();
+        qRegisterMetaType<ItemListPtr>();
+        registered = true;
+    }
+}
+
+int main(int argc, char *argv[])
+{
+#ifdef ONLY_FOR_EBOOK
+//    gtk_init( &argc, &argv );
+
+    /* Initialize the osso context */
+    osso_context_t *osso_context = osso_initialize( "GroupSMS", "1.0", TRUE, NULL );
+    if( !osso_context )
+    {
+        //qDebug() << "Couldn't initialize osso context";
+        return false;
+    }
+
+    /* Initialize abook, which also initializes all the
+             * libraries it needs (GTK+, Galago, Gnome-VFS) */
+    osso_abook_init( &argc, &argv, osso_context);
+#endif
+
+    QDir dir( QDir::homePath() );
+    dir.mkdir( HOME_DIR );
+
+    QApplication a(argc, argv);
+
+    registerTypes();
+
+#if defined(Q_WS_S60)
+    MainWindow::getInstance()->show();
+#else
+    MainWindow::getInstance()->show();
+#endif
+    return a.exec();
+}