Permalink
Browse files

desktop app should dump offline databases in AppData directory (QDesk…

…topServices::DataLocation)
  • Loading branch information...
1 parent fd2bbf6 commit aad0ce088ae7412a1766677b0f5097e3fca088d9 @netroy committed Mar 21, 2012
Showing with 35 additions and 35 deletions.
  1. +0 −17 desktop/QWunderlist.pro
  2. +4 −0 desktop/Wunderlist.pro
  3. +31 −18 desktop/main.cpp
View
@@ -1,17 +0,0 @@
-#-------------------------------------------------
-#
-# Project created by QtCreator 2012-03-21T09:44:06
-#
-#-------------------------------------------------
-
-QT += core gui webkit
-
-TARGET = Wunderlist
-TEMPLATE = app
-
-
-SOURCES += main.cpp
-
-HEADERS +=
-
-FORMS +=
View
@@ -0,0 +1,4 @@
+TARGET = bin/Wunderlist
+QT += core gui webkit
+TEMPLATE = app
+SOURCES += main.cpp
View
@@ -1,46 +1,59 @@
#include <QtGui/QApplication>
#include <QWebView>
+#include <QWebFrame>
#include <QWebSettings>
#include <QWebInspector>
#include <QUrl>
#include <QString>
+#include <QDesktopServices>
+#include <QMenu>
+#include <QMenuBar>
+
int main(int argc, char *argv[]) {
- QString storagePath = QString('/tmp/data');
+ QString storagePath = QDesktopServices::storageLocation(QDesktopServices::DataLocation) + "/Wunderlist";
QApplication a(argc, argv);
QWebView *view = new QWebView;
- QWebInspector *inspector = new QWebInspector;
+ view->setMinimumSize(760, 450);
+
QWebPage *page = view->page();
- QWebSettings *settings = page->settings();
+ QWebFrame *frame = page->mainFrame();
+ QWebSettings *webViewSettings = page->settings()->globalSettings();
+
+ QMenu *settingsMenu = new QMenu("&Settings");
+ QMenu *aboutUsMenu = new QMenu("About &Us");
+ QMenuBar *menuBar = new QMenuBar(view);
+ menuBar->addMenu(settingsMenu);
+ menuBar->addMenu(aboutUsMenu);
+
+ // Enable Inspect option
+ webViewSettings->setAttribute(QWebSettings::DeveloperExtrasEnabled, true);
- settings->enablePersistentStorage("/tmp/data");
+ // Enable Remote URL access for Sync
+ webViewSettings->setAttribute(QWebSettings::LocalContentCanAccessRemoteUrls, true);
+
+ // All Offline storage path
+ webViewSettings->enablePersistentStorage(storagePath);
+ webViewSettings->setOfflineStoragePath(storagePath);
// Enable localstorage
- settings->setAttribute(QWebSettings::LocalStorageEnabled, true);
- //settings->setLocalStoragePath("/tmp/data");
+ webViewSettings->setAttribute(QWebSettings::LocalStorageEnabled, true);
// Enable WebSQl database
- settings->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled,true);
- //settings->setOfflineStoragePath("/tmp/data");
- settings->setOfflineStorageDefaultQuota(5*1024*1024);
+ webViewSettings->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled,true);
+ webViewSettings->setOfflineStorageDefaultQuota(5*1024*1024);
// Enable Offline AppCache
- settings->setAttribute(QWebSettings::OfflineWebApplicationCacheEnabled,true);
- //settings->setOfflineWebApplicationCachePath("/tmp/data");
- settings->setOfflineWebApplicationCacheQuota(5*1024*1024);
+ webViewSettings->setAttribute(QWebSettings::OfflineWebApplicationCacheEnabled,true);
+ webViewSettings->setOfflineWebApplicationCacheQuota(5*1024*1024);
// Load the Web-App
view->load(QUrl("http://localhost:8888/"));
-
- // Enable Inspect option
- settings->setAttribute(QWebSettings::DeveloperExtrasEnabled, true);
- inspector->setPage(page);
-
view->show();
- inspector->show();
return a.exec();
+
}

0 comments on commit aad0ce0

Please sign in to comment.