Skip to content

Commit

Permalink
Backup/Restore Implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
datluong committed Aug 5, 2013
1 parent 072e151 commit e2ea8e6
Show file tree
Hide file tree
Showing 39 changed files with 8,680 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Writer.pro
Original file line number Diff line number Diff line change
@@ -1,5 1,5 @@
APP_NAME = Writer

DEFINES = QUAZIP_STATIC
CONFIG = qt warn_on cascades10
LIBS = -lbbdevice -lbb -lbbsystem -lbbcascadespickers

Expand Down
72 changes: 72 additions & 0 deletions assets/BackupRestoreSheet.qml
Original file line number Diff line number Diff line change
@@ -0,0 1,72 @@
import bb.cascades 1.0

Sheet {
id: backupRestoreSheet
signal backup();
signal restore();

Page {
titleBar: TitleBar {
title: "Backup/Restore"
visibility: ChromeVisibility.Visible
dismissAction: ActionItem {
title: "Cancel"
onTriggered: {
backupRestoreSheet.close();
}
}
}

Container {
Container {}
Container {
leftPadding: 24
rightPadding: 24
topPadding: 44
bottomPadding: 28
horizontalAlignment: HorizontalAlignment.Fill
Button {
horizontalAlignment: HorizontalAlignment.Fill
text: "Backup your writings"
onClicked: {
backup();
backupRestoreSheet.close();
}
}
Label {
topMargin: 12
horizontalAlignment: HorizontalAlignment.Left
text: "This will create a backup file, containing all of your writings and save it to a specified backup destination."
multiline: true
textStyle.fontSize: FontSize.XSmall
textStyle.color: Color.DarkGray
}
} // end of back up Container
Container {
visible: true
leftPadding: 24
rightPadding: 24
bottomPadding: 28
horizontalAlignment: HorizontalAlignment.Fill
Button {
horizontalAlignment: HorizontalAlignment.Fill
text: "Restore your writings"
onClicked: {
restore();
backupRestoreSheet.close();
}
}
Label {
topMargin: 12
horizontalAlignment: HorizontalAlignment.Center
multiline: true
text: "Restore your writings from a backup file."
textStyle.fontSize: FontSize.XSmall
textStyle.color: Color.DarkGray
}
} // restore Container

} // end of Root Container
} // end of Page

} // end of Sheet
30 changes: 30 additions & 0 deletions assets/DocumentBrowser.qml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 15,7 @@ Page {
property string rowDividerColor: '';
property string rowHighlightColor: '';
property variant themePickerSheet;
property variant backupRestoreSheet;

signal folderNameChanged();

Expand Down Expand Up @@ -382,6 383,14 @@ Page {
onTriggered: {
actionPickTheme();
}
},
ActionItem {
title: "Backup/Restore"
ActionBar.placement: ActionBarPlacement.InOverflow
imageSource: "asset:///images/icon-backup.png"
onTriggered: {
actionBackupRestore();
}
}
]

Expand Down Expand Up @@ -700,5 709,26 @@ Page {
function onThemePickerSheetClosed() {
themePickerSheet.destroy();
}

///////////////////////////////////////////////////////////////////////////
function actionBackupRestore() {
backupRestoreSheet = backupRestoreSheetDef.createObject();
backupRestoreSheet.closed.connect( onBackupRestoreSheetClosed );
backupRestoreSheet.backup.connect( onBackupActionSelected );
backupRestoreSheet.restore.connect( onRestoreActionSelected );
backupRestoreSheet.open();
}

function onBackupRestoreSheetClosed() {
backupRestoreSheet.destroy();
}

function onBackupActionSelected() {
writerApp.actionBackup();
}

function onRestoreActionSelected() {
writerApp.actionRestore();
}

} // end of Page
Binary file added assets/images/icon-backup.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions assets/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 20,10 @@ NavigationPane {
id: themePickerSheetDef
source: "ThemePickerSheet.qml"
},
ComponentDefinition {
id: backupRestoreSheetDef
source: "BackupRestoreSheet.qml"
},
SystemDialog {
id: deleteConfirmationDialog
title: "Delete"
Expand Down Expand Up @@ -84,5 88,22 @@ NavigationPane {
}
}

/**
* Pop all Pages on stack to root page and refresh the root page
*/
function resetNavigationStack() {
while (rootNavigationPane.count() > 1) {
rootNavigationPane.pop();
}
if (rootNavigationPane.count() == 1) {
var thePage = rootNavigationPane.at(0);
if (thePage.hasOwnProperty('glMetaData')) {
var meta = thePage.glMetaData();
if (meta.pageType == 'documentBrowser')
thePage.reloadDirectory();
}
}
}

} // end of NavigationPane

100 changes: 97 additions & 3 deletions config.pri
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 3,133 @@ BASEDIR = $$quote($$_PRO_FILE_PWD_)

device {
CONFIG(debug, debug|release) {
SOURCES = $$quote($$BASEDIR/src/main.cpp) \
SOURCES = $$quote($$BASEDIR/src/lib/quazip/JlCompress.cpp) \
$$quote($$BASEDIR/src/lib/quazip/qioapi.cpp) \
$$quote($$BASEDIR/src/lib/quazip/quaadler32.cpp) \
$$quote($$BASEDIR/src/lib/quazip/quacrc32.cpp) \
$$quote($$BASEDIR/src/lib/quazip/quagzipfile.cpp) \
$$quote($$BASEDIR/src/lib/quazip/quaziodevice.cpp) \
$$quote($$BASEDIR/src/lib/quazip/quazip.cpp) \
$$quote($$BASEDIR/src/lib/quazip/quazipdir.cpp) \
$$quote($$BASEDIR/src/lib/quazip/quazipfile.cpp) \
$$quote($$BASEDIR/src/lib/quazip/quazipfileinfo.cpp) \
$$quote($$BASEDIR/src/lib/quazip/quazipnewinfo.cpp) \
$$quote($$BASEDIR/src/lib/quazip/unzip.c) \
$$quote($$BASEDIR/src/lib/quazip/zip.c) \
$$quote($$BASEDIR/src/main.cpp) \
$$quote($$BASEDIR/src/writely/GLFolderArchiver.cpp) \
$$quote($$BASEDIR/src/writely/ThemeManager.cpp) \
$$quote($$BASEDIR/src/writely/WriterUI.cpp)

HEADERS = $$quote($$BASEDIR/src/GLConstants.h) \
$$quote($$BASEDIR/src/lib/quazip/JlCompress.h) \
$$quote($$BASEDIR/src/lib/quazip/crypt.h) \
$$quote($$BASEDIR/src/lib/quazip/ioapi.h) \
$$quote($$BASEDIR/src/lib/quazip/quaadler32.h) \
$$quote($$BASEDIR/src/lib/quazip/quachecksum32.h) \
$$quote($$BASEDIR/src/lib/quazip/quacrc32.h) \
$$quote($$BASEDIR/src/lib/quazip/quagzipfile.h) \
$$quote($$BASEDIR/src/lib/quazip/quaziodevice.h) \
$$quote($$BASEDIR/src/lib/quazip/quazip.h) \
$$quote($$BASEDIR/src/lib/quazip/quazip_global.h) \
$$quote($$BASEDIR/src/lib/quazip/quazipdir.h) \
$$quote($$BASEDIR/src/lib/quazip/quazipfile.h) \
$$quote($$BASEDIR/src/lib/quazip/quazipfileinfo.h) \
$$quote($$BASEDIR/src/lib/quazip/quazipnewinfo.h) \
$$quote($$BASEDIR/src/lib/quazip/unzip.h) \
$$quote($$BASEDIR/src/lib/quazip/zip.h) \
$$quote($$BASEDIR/src/writely/GLFolderArchiver.h) \
$$quote($$BASEDIR/src/writely/ThemeManager.h) \
$$quote($$BASEDIR/src/writely/WriterUI.hpp)
}

CONFIG(release, debug|release) {
SOURCES = $$quote($$BASEDIR/src/main.cpp) \
SOURCES = $$quote($$BASEDIR/src/lib/quazip/JlCompress.cpp) \
$$quote($$BASEDIR/src/lib/quazip/qioapi.cpp) \
$$quote($$BASEDIR/src/lib/quazip/quaadler32.cpp) \
$$quote($$BASEDIR/src/lib/quazip/quacrc32.cpp) \
$$quote($$BASEDIR/src/lib/quazip/quagzipfile.cpp) \
$$quote($$BASEDIR/src/lib/quazip/quaziodevice.cpp) \
$$quote($$BASEDIR/src/lib/quazip/quazip.cpp) \
$$quote($$BASEDIR/src/lib/quazip/quazipdir.cpp) \
$$quote($$BASEDIR/src/lib/quazip/quazipfile.cpp) \
$$quote($$BASEDIR/src/lib/quazip/quazipfileinfo.cpp) \
$$quote($$BASEDIR/src/lib/quazip/quazipnewinfo.cpp) \
$$quote($$BASEDIR/src/lib/quazip/unzip.c) \
$$quote($$BASEDIR/src/lib/quazip/zip.c) \
$$quote($$BASEDIR/src/main.cpp) \
$$quote($$BASEDIR/src/writely/GLFolderArchiver.cpp) \
$$quote($$BASEDIR/src/writely/ThemeManager.cpp) \
$$quote($$BASEDIR/src/writely/WriterUI.cpp)

HEADERS = $$quote($$BASEDIR/src/GLConstants.h) \
$$quote($$BASEDIR/src/lib/quazip/JlCompress.h) \
$$quote($$BASEDIR/src/lib/quazip/crypt.h) \
$$quote($$BASEDIR/src/lib/quazip/ioapi.h) \
$$quote($$BASEDIR/src/lib/quazip/quaadler32.h) \
$$quote($$BASEDIR/src/lib/quazip/quachecksum32.h) \
$$quote($$BASEDIR/src/lib/quazip/quacrc32.h) \
$$quote($$BASEDIR/src/lib/quazip/quagzipfile.h) \
$$quote($$BASEDIR/src/lib/quazip/quaziodevice.h) \
$$quote($$BASEDIR/src/lib/quazip/quazip.h) \
$$quote($$BASEDIR/src/lib/quazip/quazip_global.h) \
$$quote($$BASEDIR/src/lib/quazip/quazipdir.h) \
$$quote($$BASEDIR/src/lib/quazip/quazipfile.h) \
$$quote($$BASEDIR/src/lib/quazip/quazipfileinfo.h) \
$$quote($$BASEDIR/src/lib/quazip/quazipnewinfo.h) \
$$quote($$BASEDIR/src/lib/quazip/unzip.h) \
$$quote($$BASEDIR/src/lib/quazip/zip.h) \
$$quote($$BASEDIR/src/writely/GLFolderArchiver.h) \
$$quote($$BASEDIR/src/writely/ThemeManager.h) \
$$quote($$BASEDIR/src/writely/WriterUI.hpp)
}
}

simulator {
CONFIG(debug, debug|release) {
SOURCES = $$quote($$BASEDIR/src/main.cpp) \
SOURCES = $$quote($$BASEDIR/src/lib/quazip/JlCompress.cpp) \
$$quote($$BASEDIR/src/lib/quazip/qioapi.cpp) \
$$quote($$BASEDIR/src/lib/quazip/quaadler32.cpp) \
$$quote($$BASEDIR/src/lib/quazip/quacrc32.cpp) \
$$quote($$BASEDIR/src/lib/quazip/quagzipfile.cpp) \
$$quote($$BASEDIR/src/lib/quazip/quaziodevice.cpp) \
$$quote($$BASEDIR/src/lib/quazip/quazip.cpp) \
$$quote($$BASEDIR/src/lib/quazip/quazipdir.cpp) \
$$quote($$BASEDIR/src/lib/quazip/quazipfile.cpp) \
$$quote($$BASEDIR/src/lib/quazip/quazipfileinfo.cpp) \
$$quote($$BASEDIR/src/lib/quazip/quazipnewinfo.cpp) \
$$quote($$BASEDIR/src/lib/quazip/unzip.c) \
$$quote($$BASEDIR/src/lib/quazip/zip.c) \
$$quote($$BASEDIR/src/main.cpp) \
$$quote($$BASEDIR/src/writely/GLFolderArchiver.cpp) \
$$quote($$BASEDIR/src/writely/ThemeManager.cpp) \
$$quote($$BASEDIR/src/writely/WriterUI.cpp)

HEADERS = $$quote($$BASEDIR/src/GLConstants.h) \
$$quote($$BASEDIR/src/lib/quazip/JlCompress.h) \
$$quote($$BASEDIR/src/lib/quazip/crypt.h) \
$$quote($$BASEDIR/src/lib/quazip/ioapi.h) \
$$quote($$BASEDIR/src/lib/quazip/quaadler32.h) \
$$quote($$BASEDIR/src/lib/quazip/quachecksum32.h) \
$$quote($$BASEDIR/src/lib/quazip/quacrc32.h) \
$$quote($$BASEDIR/src/lib/quazip/quagzipfile.h) \
$$quote($$BASEDIR/src/lib/quazip/quaziodevice.h) \
$$quote($$BASEDIR/src/lib/quazip/quazip.h) \
$$quote($$BASEDIR/src/lib/quazip/quazip_global.h) \
$$quote($$BASEDIR/src/lib/quazip/quazipdir.h) \
$$quote($$BASEDIR/src/lib/quazip/quazipfile.h) \
$$quote($$BASEDIR/src/lib/quazip/quazipfileinfo.h) \
$$quote($$BASEDIR/src/lib/quazip/quazipnewinfo.h) \
$$quote($$BASEDIR/src/lib/quazip/unzip.h) \
$$quote($$BASEDIR/src/lib/quazip/zip.h) \
$$quote($$BASEDIR/src/writely/GLFolderArchiver.h) \
$$quote($$BASEDIR/src/writely/ThemeManager.h) \
$$quote($$BASEDIR/src/writely/WriterUI.hpp)
}
}

INCLUDEPATH = $$quote($$BASEDIR/src/writely) \
$$quote($$BASEDIR/src/lib/quazip) \
$$quote($$BASEDIR/src)

CONFIG = precompile_header
Expand Down
Loading

0 comments on commit e2ea8e6

Please sign in to comment.