Changed he database, and updated all references to the database where

appropriate. Paving the ground for implementing a pause/resume feature.
This commit is contained in:
Juan Carlos Cornejo 2011-12-13 00:29:55 -05:00 committed by Klaas Freitag
parent 76ca736e43
commit ff9a6826ac
14 changed files with 497 additions and 245 deletions

View file

@ -1,7 +1,7 @@
/****************************************************************************** /******************************************************************************
* Copyright 2011 Juan Carlos Cornejo jc2@paintblack.com * Copyright 2011 Juan Carlos Cornejo jc2@paintblack.com
* *
* This file is part of owncloud_sync. * This file is part of owncloud_sync_qt.
* *
* owncloud_sync is free software: you can redistribute it and/or modify * owncloud_sync is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -16,7 +16,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with owncloud_sync. If not, see <http://www.gnu.org/licenses/>. * along with owncloud_sync. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/ ******************************************************************************/
#include "SyncDebug.h" #include "SyncGlobal.h"
#include "OwnCloudSync.h" #include "OwnCloudSync.h"
#include "sqlite3_util.h" #include "sqlite3_util.h"
#include "QWebDAV.h" #include "QWebDAV.h"
@ -237,9 +237,6 @@ void OwnCloudSync::sync()
// If this is the first run, scan the directory, otherwise just wait // If this is the first run, scan the directory, otherwise just wait
// for the watcher to update us :) // for the watcher to update us :)
if(mIsFirstRun) { if(mIsFirstRun) {
//emit toLog("Clear files found!");
QSqlQuery query(QSqlDatabase::database(mAccountName));
query.exec("UPDATE local_files SET found='' WHERE conflict='';");
//syncDebug() << "Scanning local directory: "; //syncDebug() << "Scanning local directory: ";
scanLocalDirectory(mLocalDirectory); scanLocalDirectory(mLocalDirectory);
//syncDebug() << "Scanning local directory!!!"; //syncDebug() << "Scanning local directory!!!";
@ -280,41 +277,36 @@ void OwnCloudSync::processDirectoryListing(QList<QWebDAV::FileInfo> fileInfo)
// Compare against the database of known files // Compare against the database of known files
QSqlQuery query(QSqlDatabase::database(mAccountName)); QSqlQuery query(QSqlDatabase::database(mAccountName));
QSqlQuery add(QSqlDatabase::database(mAccountName)); QSqlQuery add(QSqlDatabase::database(mAccountName));
QString conflict("");
QString prev("");
for(int i = 0; i < fileInfo.size(); i++ ){ for(int i = 0; i < fileInfo.size(); i++ ){
// Check if it is a restricted file // Check if it is a restricted file
if ( isFileFiltered(fileInfo[i].fileName)) { if ( isFileFiltered(fileInfo[i].fileName)) {
continue; continue;
} }
query = queryDBFileInfo(fileInfo[i].fileName,"server_files"); query = queryDBFileInfo(fileInfo[i].fileName,"server_files");
if(query.next()) { // File exists confirm no conflict, then update if(query.next()) { // File exists get conflict and last_modified
if( query.value(7).toString() == "" ) { prev = query.value(4).toString();
QString prevModified = query.value(4).toString(); conflict = query.value(7).toString();
QString updateStatement = if ( conflict != "" && !mUploadingConflictFilesSet.contains(
QString("UPDATE server_files SET file_size='%1'," fileInfo[i].fileName.replace(" ","_sssspace_")) ) {
"last_modified='%2',found='yes',prev_modified='%3'"
" where file_name='%4'")
.arg(fileInfo[i].size)
.arg(fileInfo[i].lastModified)
.arg(prevModified)
.arg(fileInfo[i].fileName);
add.exec(updateStatement);
//syncDebug() << "SQuery: " << updateStatement;
} else if ( !mUploadingConflictFilesSet.contains(
fileInfo[i].fileName.replace(" ","_sssspace_")) ) {
// Enable the conflict resolution window // Enable the conflict resolution window
emit conflictExists(this); emit conflictExists(this);
mConflictsExist = true; mConflictsExist = true;
//syncDebug() << "SFile still conflicts: " << fileInfo[i].fileName; //syncDebug() << "SFile still conflicts: " << fileInfo[i].fileName;
} }
} else { // File does not exist, so just add this info to the DB } // Now add to the processing DB
QString addStatement = QString("INSERT INTO server_files(file_name," QString addStatement = QString("INSERT INTO server_files_processing("
"file_size,file_type,last_modified,found,conflict) " "file_name,file_size,file_type,"
"values('%1','%2','%3','%4','yes','');") "last_modified,conflict,"
.arg(fileInfo[i].fileName).arg(fileInfo[i].size) "prev_modified) "
.arg(fileInfo[i].type).arg(fileInfo[i].lastModified); "values('%1','%2','%3','%4','%5',"
//syncDebug() << "Query: " << addStatement; "'%6');")
add.exec(addStatement); .arg(fileInfo[i].fileName).arg(fileInfo[i].size)
} .arg(fileInfo[i].type).arg(fileInfo[i].lastModified)
.arg(conflict).arg(prev);
//syncDebug() << "Query: " << addStatement;
add.exec(addStatement);
// If a collection, list those contents too // If a collection, list those contents too
if(fileInfo[i].type == "collection") { if(fileInfo[i].type == "collection") {
mDirectoryQueue.enqueue(fileInfo[i].fileName); mDirectoryQueue.enqueue(fileInfo[i].fileName);
@ -490,40 +482,39 @@ void OwnCloudSync::updateDBLocalFile(QString name, qint64 size, qint64 last,
//syncDebug() << "Local file name: " << name; //syncDebug() << "Local file name: " << name;
// Check against the database // Check against the database
QSqlQuery query = queryDBFileInfo(name,"local_files"); QSqlQuery query = queryDBFileInfo(name,"local_files");
QString prev("");
QString conflict("");
QString sync("");
if (query.next() ) { // We already knew about this file. Update info. if (query.next() ) { // We already knew about this file. Update info.
qint64 prevModified = query.value(4).toString().toLongLong(); prev = query.value(4).toString();
conflict = query.value(8).toString();
sync = query.value(5).toString();
qint64 prevModified = prev.toLongLong();
// Sometimes the watcher goes crazy, though. So check to see // Sometimes the watcher goes crazy, though. So check to see
// if last == previous, if so, then it never changed anything! // if last == previous, if so, then it never changed anything!
//syncDebug() << "Last: " << last << " Prev: " << prevModified; //syncDebug() << "Last: " << last << " Prev: " << prevModified;
if( (last != prevModified) || mIsFirstRun ) { if( (last != prevModified) || mIsFirstRun ) {
if ( query.value(8).toString() == "") { if (conflict != "") {
QString updateStatement =
QString("UPDATE local_files SET file_size='%1',"
"last_modified='%2',found='yes',"
"prev_modified='%3' where file_name='%4'")
.arg(size)
.arg(last)
.arg(prevModified)
.arg(name);
//syncDebug() << "Query: " << updateStatement;
query.exec(updateStatement);
} else {
// Enable the conflict resolution button // Enable the conflict resolution button
emit conflictExists(this); emit conflictExists(this);
mConflictsExist = true; mConflictsExist = true;
//syncDebug() << "LFile still conflicts: " << name; //syncDebug() << "LFile still conflicts: " << name;
} }
} else {
return; // Nothing changed
} }
} else { // We did not know about this file, add
QString addStatement = QString("INSERT INTO local_files (file_name,"
"file_size,file_type,last_modified,found,conflict) "
"values('%1','%2','%3','%4','yes','');")
.arg(name).arg(size).arg(type).arg(last);
//syncDebug() << "Query: " << addStatement;
query.exec(addStatement);
} }
QString addStatement = QString("INSERT INTO local_files_processing "
"(file_name,file_size,file_type,"
"last_modified,prev_modified,conflict,"
"last_sync) values('%1','%2','%3','%4','%5',"
"'%6','%7');")
.arg(name).arg(size).arg(type).arg(last).arg(prev).arg(conflict)
.arg(sync);
//syncDebug() << "Query: " << addStatement;
query.exec(addStatement);
mNeedsSync = true; // Since a local file was changed, we need to sync mNeedsSync = true; // Since a local file was changed, we need to sync
// before closing // before closing
//syncDebug() << "Processing: " << mLocalDirectory + relativeName << " Size: " //syncDebug() << "Processing: " << mLocalDirectory + relativeName << " Size: "
// << file.size(); // << file.size();
} }
@ -546,9 +537,32 @@ QSqlQuery OwnCloudSync::queryDBAllFiles(QString table)
void OwnCloudSync::syncFiles() void OwnCloudSync::syncFiles()
{ {
QList<QString> localDirs; QList<QString> localDirs;
QSqlQuery localQuery = queryDBAllFiles("local_files"); QSqlQuery localQuery;
QSqlQuery serverQuery = queryDBAllFiles("server_files"); if( !mIsFirstRun ) {
localQuery = queryDBAllFiles("local_files");
while ( localQuery.next() ) {
QSqlQuery query(QSqlDatabase::database(mAccountName));
query.exec(QString("SELECT file_name FROM local_files_processing "
"WHERE file_name='%1'")
.arg(localQuery.value(1).toString()));
if(!query.next()) {
query.exec(QString("INSERT INTO local_files_processing (file_name,"
"file_size,file_type,last_modified,last_sync,"
"prev_modified,conflict) "
"values('%1','%2','%3','%4','%5','%6','%7');")
.arg(localQuery.value(1).toString())
.arg(localQuery.value(2).toString())
.arg(localQuery.value(3).toString())
.arg(localQuery.value(4).toString())
.arg(localQuery.value(5).toString())
.arg(localQuery.value(7).toString())
.arg(localQuery.value(8).toString())
);
}
}
}
localQuery = queryDBAllFiles("local_files_processing");
// Reset the progress trackers // Reset the progress trackers
mTotalToDownload = 0; mTotalToDownload = 0;
mTotalToUpload = 0; mTotalToUpload = 0;
@ -558,16 +572,14 @@ void OwnCloudSync::syncFiles()
mTotalTransfered = 0; mTotalTransfered = 0;
//mUploadingFiles.clear(); //mUploadingFiles.clear();
//mDownloadingFiles.clear(); //mDownloadingFiles.clear();
// Find out which local files need to be uploaded // Find out which local files need to be uploaded
while ( localQuery.next() ) { while ( localQuery.next() && localQuery.value(7).toString() == "" ) {
QString localName = localQuery.value(1).toString(); QString localName = localQuery.value(1).toString();
qint64 localSize = localQuery.value(2).toString().toLongLong(); qint64 localSize = localQuery.value(2).toString().toLongLong();
QString localType = localQuery.value(3).toString(); QString localType = localQuery.value(3).toString();
qint64 localModified = localQuery.value(4).toString().toLongLong(); qint64 localModified = localQuery.value(4).toString().toLongLong();
qint64 lastSync = localQuery.value(5).toString().toLongLong(); qint64 lastSync = localQuery.value(5).toString().toLongLong();
qint64 localPrevModified = localQuery.value(7).toString().toLongLong(); qint64 localPrevModified = localQuery.value(6).toString().toLongLong();
QDateTime localModifiedTime; QDateTime localModifiedTime;
localModifiedTime.setTimeSpec(Qt::UTC); localModifiedTime.setTimeSpec(Qt::UTC);
localModifiedTime.setMSecsSinceEpoch(localModified); localModifiedTime.setMSecsSinceEpoch(localModified);
@ -580,21 +592,23 @@ void OwnCloudSync::syncFiles()
//syncDebug() << "LFile: " << localName << " Size: " << localSize << " vs " //syncDebug() << "LFile: " << localName << " Size: " << localSize << " vs "
// << localQuery.value(2).toString() << " type: " << localType ; // << localQuery.value(2).toString() << " type: " << localType ;
// Query the database and look for this file // Query the database and look for this file
QSqlQuery query = queryDBFileInfo(localName,"server_files"); QSqlQuery query = queryDBFileInfo(localName,"server_files_processing");
syncDebug() << "Will check server!" << localName;
if( query.next() ) { if( query.next() ) {
syncDebug() << "Server checked!!!";
// Check when this file was last modified, and check to see // Check when this file was last modified, and check to see
// when we last synced // when we last synced
//QString serverType = query.value(3).toString(); //QString serverType = query.value(3).toString();
qint64 serverSize = query.value(2).toString().toLongLong(); qint64 serverSize = query.value(2).toString().toLongLong();
qint64 serverModified = query.value(4).toString().toLongLong(); qint64 serverModified = query.value(4).toString().toLongLong();
qint64 serverPrevModified = query.value(6).toString().toLongLong(); qint64 serverPrevModified = query.value(5).toString().toLongLong();
QDateTime serverModifiedTime; QDateTime serverModifiedTime;
serverModifiedTime.setTimeSpec(Qt::UTC); serverModifiedTime.setTimeSpec(Qt::UTC);
serverModifiedTime.setMSecsSinceEpoch(serverModified); serverModifiedTime.setMSecsSinceEpoch(serverModified);
QDateTime serverPrevModifiedTime; QDateTime serverPrevModifiedTime;
serverPrevModifiedTime.setTimeSpec(Qt::UTC); serverPrevModifiedTime.setTimeSpec(Qt::UTC);
serverPrevModifiedTime.setMSecsSinceEpoch(serverPrevModified); serverPrevModifiedTime.setMSecsSinceEpoch(serverPrevModified);
syncDebug() << serverModifiedTime << localModifiedTime << lastSyncTime;
if( serverModifiedTime < localModifiedTime && if( serverModifiedTime < localModifiedTime &&
localModifiedTime > lastSyncTime ) { // Server is older! localModifiedTime > lastSyncTime ) { // Server is older!
// Now check to see if the server too modified the file // Now check to see if the server too modified the file
@ -605,9 +619,9 @@ void OwnCloudSync::syncFiles()
serverModifiedTime > lastSyncTime) { serverModifiedTime > lastSyncTime) {
// There is a conflict, both files got changed since the // There is a conflict, both files got changed since the
// last time we synced // last time we synced
/*syncDebug() << "Conflict with sfile " << localName syncDebug() << "Conflict with sfile " << localName
<< serverModifiedTime << serverPrevModifiedTime << serverModifiedTime << serverPrevModifiedTime
<< localModifiedTime << lastSyncTime;*/ << localModifiedTime << lastSyncTime;
setFileConflict(localName,localSize, setFileConflict(localName,localSize,
serverModifiedTime.toString(), serverModifiedTime.toString(),
localModifiedTime.toString()); localModifiedTime.toString());
@ -640,29 +654,38 @@ void OwnCloudSync::syncFiles()
//syncDebug() << "OLDER: " << localName; //syncDebug() << "OLDER: " << localName;
} }
} }
} else { // The same! (I highly doubt that!) } else { // Up to date
//syncDebug() << "SAME: " << localName; if(!mIsFirstRun)
copyLocalProcessing(localName);
} }
} else { // Does not exist on server! Upload! } else { // Does not exist on server! Check if maybe it was deleted
//syncDebug() << "NEW: " << localName; QSqlQuery check = queryDBFileInfo(localName,"server_files");
if ( localType == "collection") { if(!check.next()) {
mMakeServerDirs.enqueue(localName); //syncDebug() << "NEW: " << localName;
} else { if ( localType == "collection") {
mUploadingFiles.enqueue(FileInfo(localName,localSize)); mMakeServerDirs.enqueue(localName);
mTotalToUpload += localSize; } else {
mUploadingFiles.enqueue(FileInfo(localName,localSize));
mTotalToUpload += localSize;
}
} }
} }
} }
// Find out which remote files need to be downloaded (only the ones // Find out which files exist on the server but not locally. Set to download
// that don't exist) QSqlQuery serverQuery = queryDBAllFiles("server_files_processing");
while ( serverQuery.next() ) { while ( serverQuery.next() ) {
QString serverName = serverQuery.value(1).toString(); QString serverName = serverQuery.value(1).toString();
qint64 serverSize = serverQuery.value(2).toString().toLongLong(); qint64 serverSize = serverQuery.value(2).toString().toLongLong();
QString serverType = serverQuery.value(3).toString(); QString serverType = serverQuery.value(3).toString();
//syncDebug() << "SFile: " << serverName << " Size: " << serverSize << " vs " //syncDebug() << "SFile: " << serverName << " Size: " << serverSize << " vs "
// << serverQuery.value(2).toString() << " type: " << serverType ; // << serverQuery.value(2).toString() << " type: " << serverType ;
QSqlQuery query = queryDBFileInfo(serverName,"local_files"); QSqlQuery query;
if(mIsFirstRun) {
query = queryDBFileInfo(serverName,"local_files_processing");
} else {
query = queryDBFileInfo(serverName,"local_files");
}
if( !query.next() ) { if( !query.next() ) {
if( serverType == "collection") { if( serverType == "collection") {
localDirs.append(serverName); localDirs.append(serverName);
@ -670,7 +693,7 @@ void OwnCloudSync::syncFiles()
mDownloadingFiles.enqueue(FileInfo(serverName,serverSize)); mDownloadingFiles.enqueue(FileInfo(serverName,serverSize));
mTotalToDownload += serverSize; mTotalToDownload += serverSize;
} }
//syncDebug() << "DOWNLOAD: " << serverName; syncDebug() << "DOWNLOAD new file: " << serverName;
} }
} }
for( int i = 0; i < mDownloadConflict.size(); i++ ) { for( int i = 0; i < mDownloadConflict.size(); i++ ) {
@ -696,10 +719,6 @@ void OwnCloudSync::syncFiles()
// Delete removed files and reset the file status // Delete removed files and reset the file status
deleteRemovedFiles(); deleteRemovedFiles();
QSqlQuery query(QSqlDatabase::database(mAccountName));
//query.exec("UPDATE local_files SET found='' WHERE conflict='';");
query.exec("UPDATE server_files SET found='' WHERE conflict='';");
mIsFirstRun = false; mIsFirstRun = false;
// Let's get the ball rolling! // Let's get the ball rolling!
@ -710,10 +729,10 @@ void OwnCloudSync::setFileConflict(QString name, qint64 size, QString server_las
QString local_last) QString local_last)
{ {
QSqlQuery conflict(QSqlDatabase::database(mAccountName)); QSqlQuery conflict(QSqlDatabase::database(mAccountName));
QString conflictText = QString("UPDATE server_files SET conflict='yes'" QString conflictText = QString("UPDATE server_files_processing SET conflict='yes'"
" WHERE file_name='%1';").arg(name); " WHERE file_name='%1';").arg(name);
conflict.exec(conflictText); conflict.exec(conflictText);
conflictText = QString("UPDATE local_files SET conflict='yes'" conflictText = QString("UPDATE local_files_processing SET conflict='yes'"
" WHERE file_name='%1';").arg(name); " WHERE file_name='%1';").arg(name);
conflict.exec(conflictText); conflict.exec(conflictText);
conflictText = QString("INSERT INTO conflicts values('%1','','%2','%3');") conflictText = QString("INSERT INTO conflicts values('%1','','%2','%3');")
@ -776,33 +795,34 @@ void OwnCloudSync::updateDBDownload(QString name)
dbName = mRemoteDirectory + name; dbName = mRemoteDirectory + name;
} }
// Check against the database
QSqlQuery query = queryDBFileInfo(dbName,"local_files");
if (query.next() ) { // We already knew about this file. Update.
QString updateStatement =
QString("UPDATE local_files SET file_size='%1',"
"last_modified='%2',last_sync='%3' where file_name='%4'")
.arg(file.size())
.arg(file.lastModified().toUTC()
.toMSecsSinceEpoch())
.arg(file.lastModified().toUTC()
.toMSecsSinceEpoch())
.arg(dbName);
query.exec(updateStatement);
} else { // We did not know about this file, add
QString addStatement = QString("INSERT INTO local_files (file_name,"
"file_size,file_type,last_modified,last_sync) "
"values('%1','%2','%3','%4','%5');")
.arg(dbName).arg(file.size())
.arg("file")
.arg(file.lastModified().toUTC().toMSecsSinceEpoch())
.arg(file.lastModified().toUTC().toMSecsSinceEpoch());
query.exec(addStatement);
}
QString downloadText; QString downloadText;
if( mDownloadingConflictingFile ) { if( mDownloadingConflictingFile ) {
downloadText = tr("Downloaded conflicting file: %1").arg(dbName); downloadText = tr("Downloaded conflicting file: %1").arg(dbName);
} else { } else {
// Check against the database
QSqlQuery query = queryDBFileInfo(dbName,"local_files");
if (query.next() ) { // We already knew about this file. Update.
QString updateStatement =
QString("UPDATE local_files SET file_size='%1',"
"last_modified='%2',last_sync='%3' where file_name='%4'")
.arg(file.size())
.arg(file.lastModified().toUTC()
.toMSecsSinceEpoch())
.arg(file.lastModified().toUTC()
.toMSecsSinceEpoch())
.arg(dbName);
query.exec(updateStatement);
} else { // We did not know about this file, add
QString addStatement = QString("INSERT INTO local_files (file_name,"
"file_size,file_type,last_modified,last_sync) "
"values('%1','%2','%3','%4','%5');")
.arg(dbName).arg(file.size())
.arg("file")
.arg(file.lastModified().toUTC().toMSecsSinceEpoch())
.arg(file.lastModified().toUTC().toMSecsSinceEpoch());
query.exec(addStatement);
}
copyServerProcessing(dbName);
downloadText = tr("Downloaded file: %1").arg(dbName); downloadText = tr("Downloaded file: %1").arg(dbName);
} }
emit toLog(downloadText); emit toLog(downloadText);
@ -820,6 +840,7 @@ void OwnCloudSync::updateDBUpload(QString name)
// Check against the database // Check against the database
QSqlQuery query = queryDBFileInfo(name,"server_files"); QSqlQuery query = queryDBFileInfo(name,"server_files");
if (query.next() ) { // We already knew about this file. Update. if (query.next() ) { // We already knew about this file. Update.
copyServerProcessing(name);
QString updateStatement = QString updateStatement =
QString("UPDATE server_files SET file_size='%1'," QString("UPDATE server_files SET file_size='%1',"
"last_modified='%2' where file_name='%3'") "last_modified='%2' where file_name='%3'")
@ -827,11 +848,11 @@ void OwnCloudSync::updateDBUpload(QString name)
.arg(time).arg(name); .arg(time).arg(name);
//syncDebug() << "Query: " << updateStatement; //syncDebug() << "Query: " << updateStatement;
query.exec(updateStatement); query.exec(updateStatement);
updateStatement = // updateStatement =
QString("UPDATE local_files SET last_sync='%1'" // QString("UPDATE local_files_processing SET last_sync='%1'"
"where file_name='%2'") // "where file_name='%2'")
.arg(time).arg(name); // .arg(time).arg(name);
query.exec(updateStatement); // query.exec(updateStatement);
//syncDebug() << "Query: " << updateStatement; //syncDebug() << "Query: " << updateStatement;
} else { // We did not know about this file, add } else { // We did not know about this file, add
QString addStatement = QString("INSERT INTO server_files (file_name," QString addStatement = QString("INSERT INTO server_files (file_name,"
@ -841,13 +862,19 @@ void OwnCloudSync::updateDBUpload(QString name)
.arg("file") .arg("file")
.arg(time); .arg(time);
query.exec(addStatement); query.exec(addStatement);
QString updateStatement = // QString updateStatement =
QString("UPDATE local_files SET file_size='%1'," // QString("UPDATE local_files_processing SET file_size='%1',"
"last_modified='%2',last_sync='%3' where file_name='%4'") // "last_modified='%2',last_sync='%3' where file_name='%4'")
.arg(file.size()).arg(time).arg(time).arg(name); // .arg(file.size()).arg(time).arg(time).arg(name);
query.exec(updateStatement); // query.exec(updateStatement);
} }
emit toLog(tr("Uploaded file: %1").arg(name)); emit toLog(tr("Uploaded file: %1").arg(name));
QString updateStatement =
QString("UPDATE local_files_processing SET last_sync='%1'"
"where file_name='%2'")
.arg(time).arg(name);
query.exec(updateStatement);
copyLocalProcessing(name);
mTotalTransfered += mCurrentFileSize; mTotalTransfered += mCurrentFileSize;
processNextStep(); processNextStep();
} }
@ -873,9 +900,50 @@ void OwnCloudSync::transferProgress(qint64 current, qint64 total)
restartRequestTimer(); restartRequestTimer();
} }
void OwnCloudSync::updateDBVersion(int fromVersion)
{
QSqlQuery query(QSqlDatabase::database(mAccountName));
switch(fromVersion) {
case 0: // Same as Version 1 (used in case a version is not found)
case 1:
case 2:
QString createVersion("create table db_version(\n"
"\tversion integer"
");");
QString updateVersion = QString("INSERT INTO db_version values('%1');")
.arg(_OCS_DB_VERSION);
QString createLocalProcessing("create table local_files_processing(\n"
"\tid INTEGER PRIMARY KEY ASC,\n"
"\tfile_name text unique,\n"
"\tfile_size text,\n"
"\tfile_type text,\n"
"\tlast_modified text,\n"
"\tlast_sync text,\n"
"\tprev_modified text,\n"
"\tconflict text\n"
");");
QString createServerProcessing("create table server_files_processing(\n"
"\tid INTEGER PRIMARY KEY ASC,\n"
"\tfile_name text unique,\n"
"\tfile_size text,\n"
"\tfile_type text,\n"
"\tlast_modified text,\n"
"\tprev_modified text,\n"
"\tconflict text\n"
");");
query.exec(createVersion);
query.exec(updateVersion);
query.exec(createLocalProcessing);
query.exec(createServerProcessing);
break;
}
}
void OwnCloudSync::createDataBase() void OwnCloudSync::createDataBase()
{ {
//syncDebug() << "Creating Database!"; syncDebug() << "Creating Database!";
if(!mDB.open()) { if(!mDB.open()) {
syncDebug() << "Cannot open database for creation!"; syncDebug() << "Cannot open database for creation!";
syncDebug() << mDB.lastError().text(); syncDebug() << mDB.lastError().text();
@ -884,60 +952,98 @@ void OwnCloudSync::createDataBase()
mDBOpen = true; mDBOpen = true;
} }
QString createLocal("create table local_files(\n" QString createLocal("create table local_files(\n"
"id INTEGER PRIMARY KEY ASC,\n" "\tid INTEGER PRIMARY KEY ASC,\n"
"file_name text unique,\n" "\tfile_name text unique,\n"
"file_size text,\n" "\tfile_size text,\n"
"file_type text,\n" "\tfile_type text,\n"
"last_modified text,\n" "\tlast_modified text,\n"
"last_sync text,\n" "\tlast_sync text,\n"
"found text,\n" "\tfound text,\n"
"prev_modified text,\n" "\tprev_modified text,\n"
"conflict text\n" "\tconflict text\n"
");"); ");");
QString createServer("create table server_files(\n" QString createServer("create table server_files(\n"
"id INTEGER PRIMARY KEY ASC,\n" "\tid INTEGER PRIMARY KEY ASC,\n"
"file_name text unique,\n" "\tfile_name text unique,\n"
"file_size text,\n" "\tfile_size text,\n"
"file_type text,\n" "\tfile_type text,\n"
"last_modified text,\n" "\tlast_modified text,\n"
"found text,\n" "\tfound text,\n"
"prev_modified text,\n" "\tprev_modified text,\n"
"conflict text\n" "\tconflict text\n"
");"); ");");
QString createLocalProcessing("create table local_files_processing(\n"
"\tid INTEGER PRIMARY KEY ASC,\n"
"\tfile_name text unique,\n"
"\tfile_size text,\n"
"\tfile_type text,\n"
"\tlast_modified text,\n"
"\tlast_sync text,\n"
"\tprev_modified text,\n"
"\tconflict text\n"
");");
QString createServerProcessing("create table server_files_processing(\n"
"\tid INTEGER PRIMARY KEY ASC,\n"
"\tfile_name text unique,\n"
"\tfile_size text,\n"
"\tfile_type text,\n"
"\tlast_modified text,\n"
"\tprev_modified text,\n"
"\tconflict text\n"
");");
QString createConflicts("create table conflicts(\n" QString createConflicts("create table conflicts(\n"
"file_name text unique,\n" "\tfile_name text unique,\n"
"resolution text,\n" "\tresolution text,\n"
"server_modified text,\n" "\tserver_modified text,\n"
"local_modified text\n" "\tlocal_modified text\n"
");"); ");");
QString createConfig("create table config(\n" QString createConfig("create table config(\n"
"host text,\n" "\thost text,\n"
"username text,\n" "\tusername text,\n"
"password text,\n" "\tpassword text,\n"
"localdir text,\n" "\tlocaldir text,\n"
"updatetime text,\n" "\tupdatetime text,\n"
"enabled text,\n" "\tenabled text,\n"
"remotedir text,\n" "\tremotedir text,\n"
"lastsync text\n" "\tlastsync text\n"
");"); ");");
QString createFilters("create table filters(\n" QString createFilters("create table filters(\n"
"filter text" "\tfilter text\n"
");"); ");");
QString createVersion("create table db_version(\n"
"\tversion integer\n"
");");
QSqlQuery query(QSqlDatabase::database(mAccountName)); QSqlQuery query(QSqlDatabase::database(mAccountName));
query.exec(createLocal); query.exec(createLocal);
query.exec(createServer); query.exec(createServer);
query.exec(createLocalProcessing);
query.exec(createServerProcessing);
query.exec(createConfig); query.exec(createConfig);
query.exec(createConflicts); query.exec(createConflicts);
query.exec(createFilters); query.exec(createFilters);
query.exec(createVersion);
} }
void OwnCloudSync::readConfigFromDB() void OwnCloudSync::readConfigFromDB()
{ {
QSqlQuery query(QSqlDatabase::database(mAccountName)); QSqlQuery query(QSqlDatabase::database(mAccountName));
// First identify what database verion we have
query.exec("SELECT * from version;");
if( query.next() ) { // We found a version
int version = query.value(0).toInt();
if( version < _OCS_DB_VERSION )
updateDBVersion(version);
} else { // No version information, update from beginning
updateDBVersion(1);
}
query.exec("SELECT * from config;"); query.exec("SELECT * from config;");
if(query.next()) { if(query.next()) {
mHost = query.value(0).toString(); mHost = query.value(0).toString();
@ -1155,57 +1261,93 @@ void OwnCloudSync::loadDBFromFile()
void OwnCloudSync::deleteRemovedFiles() void OwnCloudSync::deleteRemovedFiles()
{ {
// Any file that has not been found will be deleted! // Any file that has not been found will be deleted!
if( mIsFirstRun ) { if( mIsFirstRun ) {
//syncDebug() << "Looking for server files to delete!"; //syncDebug() << "Looking for server files to delete!";
// Since we don't always query local files except for the first run // Since we don't always query local files except for the first run
// only do this if it is the first run // only do this if it is the first run
QSqlQuery local(QSqlDatabase::database(mAccountName)); QSqlQuery local(QSqlDatabase::database(mAccountName));
QSqlQuery localFound(QSqlDatabase::database(mAccountName));
// First delete the files // First delete the files
local.exec("SELECT file_name from local_files where found='' " local.exec("SELECT file_name from local_files WHERE file_type='file';");
"AND file_type='file';");
while(local.next()) { while(local.next()) {
// Local files were deleted. Delete from server too. localFound.exec(QString("SELECT file_name from "
//syncDebug() << "Deleting file from server: " << local.value(0).toString(); "local_files_processing WHERE "
//emit toLog(tr("File claims to be not found: %1").arg( "file_name='%1';")
// local.value(0).toString())); .arg(local.value(0).toString()));
deleteFromServer(local.value(0).toString()); if(!localFound.next()) {
// Local file as deleted. Delete from server too.
//syncDebug() << "Deleting file from server: " << local.value(0).toString();
//emit toLog(tr("File claims to be not found: %1").arg(
// local.value(0).toString()));
deleteFromServer(local.value(0).toString());
} else {
copyLocalProcessing(local.value(0).toString());
}
} }
// Then delete the collections // Then delete the collections
local.exec("SELECT file_name from local_files where found='' " local.exec("SELECT file_name from local_files WHERE "
"AND file_type='collection';"); "file_type='collection';");
while(local.next()) { while(local.next()) {
//emit toLog(tr("Directory claims to be not found: %1").arg( localFound.exec(QString("SELECT file_name from "
// local.value(0).toString())); "local_files_processing WHERE "
// Local files were deleted. Delete from server too. "file_name='%1';")
syncDebug() << "Deleting directory from server: " << local.value(0).toString(); .arg(local.value(0).toString()));
deleteFromServer(local.value(0).toString()); if(!localFound.next()) {
// Local file as deleted. Delete from server too.
//syncDebug() << "Deleting file from server: " << local.value(0).toString();
//emit toLog(tr("File claims to be not found: %1").arg(
// local.value(0).toString()));
deleteFromServer(local.value(0).toString());
} else {
copyLocalProcessing(local.value(0).toString());
}
} }
} }
//syncDebug() << "Looking for local files to delete!"; //syncDebug() << "Looking for local files to delete!";
QSqlQuery server(QSqlDatabase::database(mAccountName)); QSqlQuery server(QSqlDatabase::database(mAccountName));
QSqlQuery serverFound(QSqlDatabase::database(mAccountName));
// First delete the files // First delete the files
server.exec("SELECT file_name from server_files where found=''" // First delete the files
"AND file_type='file';"); server.exec("SELECT file_name from server_files WHERE file_type='file';");
while(server.next()) { while(server.next()) {
// Server files were deleted. Delete from local too. serverFound.exec(QString("SELECT file_name from "
syncDebug() << "Deleting file from local: " << server.value(0).toString(); "server_files_processing WHERE "
//emit toLog(tr("Deleting local file: %1").arg( "file_name='%1';")
// server.value(0).toString())); .arg(server.value(0).toString()));
deleteFromLocal(server.value(0).toString(),false); if(!serverFound.next()) {
// Local file as deleted. Delete from server too.
//syncDebug() << "Deleting file from server: " << server.value(0).toString();
//emit toLog(tr("File claims to be not found: %1").arg(
// server.value(0).toString()));
syncDebug() << "Will delete local file: " << server.value(0).toString();
deleteFromLocal(server.value(0).toString(),false);
} else {
copyServerProcessing(server.value(0).toString());
}
} }
// Then delete the collections // Then delete the collections
server.exec("SELECT file_name from server_files where found=''" server.exec("SELECT file_name from server_files WHERE "
"AND file_type='collection';"); "file_type='collection';");
while(server.next()) { while(server.next()) {
// Server files were deleted. Delete from local too. serverFound.exec(QString("SELECT file_name from "
//syncDebug() << "Deleting directory from local: " << server.value(0).toString(); "server_files_processing WHERE "
deleteFromLocal(server.value(0).toString(),true); "file_name='%1';")
.arg(server.value(0).toString()));
if(!serverFound.next()) {
// Local file as deleted. Delete from server too.
//syncDebug() << "Deleting file from server: " << server.value(0).toString();
//emit toLog(tr("File claims to be not found: %1").arg(
// server.value(0).toString()));
deleteFromLocal(server.value(0).toString(),true);
} else {
copyServerProcessing(server.value(0).toString());
}
} }
} }
void OwnCloudSync::deleteFromLocal(QString name, bool isDir) void OwnCloudSync::deleteFromLocal(QString name, bool isDir)
@ -1230,6 +1372,8 @@ void OwnCloudSync::deleteFromLocal(QString name, bool isDir)
} }
dropFromDB("local_files","file_name",name); dropFromDB("local_files","file_name",name);
dropFromDB("server_files","file_name",name); dropFromDB("server_files","file_name",name);
dropFromDB("local_files_processing","file_name",name);
dropFromDB("server_files_processing","file_name",name);
} }
void OwnCloudSync::deleteFromServer(QString name) void OwnCloudSync::deleteFromServer(QString name)
@ -1239,6 +1383,8 @@ void OwnCloudSync::deleteFromServer(QString name)
emit toLog(tr("Deleting from server: %1").arg(name)); emit toLog(tr("Deleting from server: %1").arg(name));
dropFromDB("server_files","file_name",name); dropFromDB("server_files","file_name",name);
dropFromDB("local_files","file_name",name); dropFromDB("local_files","file_name",name);
dropFromDB("server_files_processing","file_name",name);
dropFromDB("local_files_processing","file_name",name);
} }
void OwnCloudSync::dropFromDB(QString table, QString column, QString condition) void OwnCloudSync::dropFromDB(QString table, QString column, QString condition)
@ -1267,6 +1413,9 @@ void OwnCloudSync::processFileConflict(QString name, QString wins)
QString statement = QString("UPDATE local_files SET last_sync='%1'" QString statement = QString("UPDATE local_files SET last_sync='%1'"
"WHERE file_name='%2';").arg(last).arg(name); "WHERE file_name='%2';").arg(last).arg(name);
query.exec(statement); query.exec(statement);
statement = QString("UPDATE local_files_processing SET last_sync='%1'"
"WHERE file_name='%2';").arg(last).arg(name);
query.exec(statement);
// Add back to the watcher // Add back to the watcher
mFileWatcher->addPath(mLocalDirectory+localName); mFileWatcher->addPath(mLocalDirectory+localName);
@ -1280,6 +1429,12 @@ void OwnCloudSync::clearFileConflict(QString name)
QString statement = QString("DELETE FROM conflicts where file_name='%1';") QString statement = QString("DELETE FROM conflicts where file_name='%1';")
.arg(name); .arg(name);
query.exec(statement); query.exec(statement);
statement = QString("UPDATE local_files_processing set conflict='' where file_name='%1';")
.arg(name);
query.exec(statement);
statement = QString("UPDATE server_files_processing set conflict='' where file_name='%1';")
.arg(name);
query.exec(statement);
statement = QString("UPDATE local_files set conflict='' where file_name='%1';") statement = QString("UPDATE local_files set conflict='' where file_name='%1';")
.arg(name); .arg(name);
query.exec(statement); query.exec(statement);
@ -1472,3 +1627,55 @@ void OwnCloudSync::serverDirectoryCreated(QString name)
emit toLog(tr("Created directory on server: %1").arg(name)); emit toLog(tr("Created directory on server: %1").arg(name));
processNextStep(); processNextStep();
} }
void OwnCloudSync::copyLocalProcessing(QString fileName)
{
syncDebug() << "Copying DB Process Local: " << fileName;
QSqlQuery queryProcessing(QSqlDatabase::database(mAccountName));
QSqlQuery query(QSqlDatabase::database(mAccountName));
queryProcessing.exec(QString("SELECT * FROM local_files_processing WHERE "
"file_name='%1';").arg(fileName));
if(queryProcessing.next()) {
query.exec(QString("DELETE FROM local_files WHERE file_name='%1';")
.arg(fileName));
query.exec(QString("INSERT INTO local_files (file_name,"
"file_size,file_type,last_modified,last_sync,"
"prev_modified,conflict) "
"values('%1','%2','%3','%4','%5','%6','%7');")
.arg(queryProcessing.value(1).toString())
.arg(queryProcessing.value(2).toString())
.arg(queryProcessing.value(3).toString())
.arg(queryProcessing.value(4).toString())
.arg(queryProcessing.value(5).toString())
.arg(queryProcessing.value(6).toString())
.arg(queryProcessing.value(7).toString())
);
}
queryProcessing.exec(QString("DELETE FROM local_files_processing WHERE "
"file_name='%1';").arg(fileName));
}
void OwnCloudSync::copyServerProcessing(QString fileName)
{
syncDebug() << "Copying DB Process Server: " << fileName;
QSqlQuery queryProcessing(QSqlDatabase::database(mAccountName));
QSqlQuery query(QSqlDatabase::database(mAccountName));
queryProcessing.exec(QString("SELECT * FROM server_files_processing WHERE "
"file_name='%1';").arg(fileName));
if(queryProcessing.next()) {
query.exec(QString("DELETE FROM server_files WHERE file_name='%1';")
.arg(fileName));
query.exec(QString("INSERT INTO server_files (file_name,"
"file_size,file_type,last_modified,prev_modified,conflict) "
"values('%1','%2','%3','%4','%5','%6');")
.arg(queryProcessing.value(1).toString())
.arg(queryProcessing.value(2).toString())
.arg(queryProcessing.value(3).toString())
.arg(queryProcessing.value(4).toString())
.arg(queryProcessing.value(5).toString())
.arg(queryProcessing.value(6).toString())
);
}
queryProcessing.exec(QString("DELETE FROM server_files_processing WHERE "
"file_name='%1';").arg(fileName));
}

View file

@ -1,7 +1,7 @@
/****************************************************************************** /******************************************************************************
* Copyright 2011 Juan Carlos Cornejo jc2@paintblack.com * Copyright 2011 Juan Carlos Cornejo jc2@paintblack.com
* *
* This file is part of owncloud_sync. * This file is part of owncloud_sync_qt.
* *
* owncloud_sync is free software: you can redistribute it and/or modify * owncloud_sync is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -158,8 +158,11 @@ private:
void upload(FileInfo fileName); void upload(FileInfo fileName);
void download(FileInfo fileName); void download(FileInfo fileName);
void updateDBDownload(QString fileName); void updateDBDownload(QString fileName);
void copyServerProcessing(QString fileName);
void copyLocalProcessing(QString fileName);
void processNextStep(); void processNextStep();
void createDataBase(); void createDataBase();
void updateDBVersion(int fromVersion);
void initialize(); void initialize();
void readConfigFromDB(); void readConfigFromDB();
void scanLocalDirectoryForNewFiles(QString name); void scanLocalDirectoryForNewFiles(QString name);

View file

@ -1,18 +0,0 @@
#include "SyncDebug.h"
SyncDebug::SyncDebug(QObject *parent):
QIODevice(parent)
{
open(ReadWrite);
}
qint64 SyncDebug::readData(char *data, qint64 length )
{
return 0;
}
qint64 SyncDebug::writeData(const char* data, qint64 length)
{
qDebug() << data;
emit debugMessage(QString(data));
}

View file

@ -1,31 +0,0 @@
#ifndef SYNCDEBUG_H
#define SYNCDEBUG_H
#include <QIODevice>
#include <QDebug>
class SyncDebug : public QIODevice
{
Q_OBJECT
public:
explicit SyncDebug( QObject *parent = 0 );
qint64 readData(char *data, qint64 length );
qint64 writeData(const char* data, qint64 length);
signals:
void debugMessage(const QString);
public slots:
};
#if !defined(QT_NO_DEBUG_STREAM)
Q_GLOBAL_STATIC( SyncDebug, getSyncDebug)
Q_CORE_EXPORT_INLINE QDebug syncDebug() { return QDebug(getSyncDebug()); }
#else // QT_NO_DEBUG_STREAM
#endif
#endif // SYNCDEBUG_H

View file

@ -0,0 +1,64 @@
/******************************************************************************
* Copyright 2011 Juan Carlos Cornejo jc2@paintblack.com
*
* This file is part of owncloud_sync_qt.
*
* owncloud_sync is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* owncloud_sync is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with owncloud_sync. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
#ifndef SYNCGLOBAL_H
#define SYNCGLOBAL_H
#include <QIODevice>
#include <QDebug>
#define _OCS_VERSION "0.5.2"
#define _OCS_DB_VERSION 2
/*! \brief An internal OwnCloud Sync Qt debugging class.
* May be used like the normal Qt qDebug() like so:
* syncDebug() << "Some debugging code"
*/
class SyncDebug : public QIODevice
{
Q_OBJECT
public:
explicit SyncDebug( QObject *parent = 0 ): QIODevice(parent) {
open(ReadWrite);
}
qint64 readData(char *data, qint64 length ) {
return 0;
}
qint64 writeData(const char* data, qint64 length){
qDebug() << data;
emit debugMessage(QString(data));
}
signals:
void debugMessage(const QString);
public slots:
};
#if !defined(QT_NO_DEBUG_STREAM)
Q_GLOBAL_STATIC( SyncDebug, getSyncDebug)
Q_CORE_EXPORT_INLINE QDebug syncDebug() { return QDebug(getSyncDebug()); }
#else // QT_NO_DEBUG_STREAM
#endif
#endif // SYNCGLOBAL_H

View file

@ -1,7 +1,7 @@
/****************************************************************************** /******************************************************************************
* Copyright 2011 Juan Carlos Cornejo jc2@paintblack.com * Copyright 2011 Juan Carlos Cornejo jc2@paintblack.com
* *
* This file is part of owncloud_sync. * This file is part of owncloud_sync_qt.
* *
* owncloud_sync is free software: you can redistribute it and/or modify * owncloud_sync is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -17,7 +17,7 @@
* along with owncloud_sync. If not, see <http://www.gnu.org/licenses/>. * along with owncloud_sync. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/ ******************************************************************************/
#include "SyncDebug.h" #include "SyncGlobal.h"
#include "SyncWindow.h" #include "SyncWindow.h"
#include "ui_SyncWindow.h" #include "ui_SyncWindow.h"
#include "sqlite3_util.h" #include "sqlite3_util.h"
@ -79,7 +79,7 @@ SyncWindow::SyncWindow(QWidget *parent) :
mSystemTrayMenu->addAction(ui->action_Quit); mSystemTrayMenu->addAction(ui->action_Quit);
mSystemTray->setContextMenu(mSystemTrayMenu); mSystemTray->setContextMenu(mSystemTrayMenu);
mSystemTray->setIcon(mDefaultIcon); mSystemTray->setIcon(mDefaultIcon);
mSystemTray->setToolTip(tr("OwnCloud Sync Version %1").arg(OCS_VERSION)); mSystemTray->setToolTip(tr("OwnCloud Sync Version %1").arg(_OCS_VERSION));
mSystemTray->show(); mSystemTray->show();
connect(mSystemTray,SIGNAL(activated(QSystemTrayIcon::ActivationReason)), connect(mSystemTray,SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
this,SLOT(systemTrayActivated(QSystemTrayIcon::ActivationReason))); this,SLOT(systemTrayActivated(QSystemTrayIcon::ActivationReason)));
@ -126,7 +126,7 @@ void SyncWindow::updateStatus()
// return; // return;
if( !mBusy ) { if( !mBusy ) {
ui->statusBar->showMessage(tr("Version %1: Waiting...").arg(OCS_VERSION)); ui->statusBar->showMessage(tr("Version %1: Waiting...").arg(_OCS_VERSION));
ui->status->setText(tr("Waiting...")); ui->status->setText(tr("Waiting..."));
ui->progressFile->setValue(0); ui->progressFile->setValue(0);
ui->progressTotal->setValue(0); ui->progressTotal->setValue(0);
@ -554,7 +554,7 @@ void SyncWindow::processNextStep()
mTotalSyncs++; mTotalSyncs++;
OwnCloudSync *account = mAccountsReadyToSync.dequeue(); OwnCloudSync *account = mAccountsReadyToSync.dequeue();
ui->statusBar->showMessage(tr("Version %1: Synchronizing %2") ui->statusBar->showMessage(tr("Version %1: Synchronizing %2")
.arg(OCS_VERSION).arg(account->getName())); .arg(_OCS_VERSION).arg(account->getName()));
account->sync(); account->sync();
} else { } else {
mBusy = false; mBusy = false;

View file

@ -1,7 +1,7 @@
/****************************************************************************** /******************************************************************************
* Copyright 2011 Juan Carlos Cornejo jc2@paintblack.com * Copyright 2011 Juan Carlos Cornejo jc2@paintblack.com
* *
* This file is part of owncloud_sync. * This file is part of owncloud_sync_qt.
* *
* owncloud_sync is free software: you can redistribute it and/or modify * owncloud_sync is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -29,8 +29,6 @@
#include <QModelIndex> #include <QModelIndex>
#include <QItemSelection> #include <QItemSelection>
#define OCS_VERSION "0.5.2"
class QTimer; class QTimer;
class OwnCloudSync; class OwnCloudSync;
class QSignalMapper; class QSignalMapper;

View file

@ -21,7 +21,7 @@
<number>0</number> <number>0</number>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>2</number> <number>0</number>
</property> </property>
<widget class="QWidget" name="page"> <widget class="QWidget" name="page">
<layout class="QGridLayout" name="gridLayout_2"> <layout class="QGridLayout" name="gridLayout_2">
@ -116,6 +116,31 @@
<property name="margin"> <property name="margin">
<number>0</number> <number>0</number>
</property> </property>
<item>
<widget class="QPushButton" name="buttonResume">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="owncloud_sync.qrc">
<normaloff>:/images/play-big.png</normaloff>:/images/play-big.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="buttonPause">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="owncloud_sync.qrc">
<normaloff>:/images/pause-big.png</normaloff>:/images/pause-big.png</iconset>
</property>
</widget>
</item>
<item> <item>
<widget class="QPushButton" name="pushButton"> <widget class="QPushButton" name="pushButton">
<property name="text"> <property name="text">
@ -126,7 +151,7 @@
<item> <item>
<widget class="QPushButton" name="pushButton_2"> <widget class="QPushButton" name="pushButton_2">
<property name="text"> <property name="text">
<string>Clear and Save Log</string> <string>Save and Clear Log</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -143,7 +168,7 @@
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="text"> <property name="text">
<string>Conflicts exist, click to resolve.</string> <string>Resolve Conflicts</string>
</property> </property>
</widget> </widget>
</item> </item>

View file

@ -1,7 +1,7 @@
/****************************************************************************** /******************************************************************************
* Copyright 2011 Juan Carlos Cornejo jc2@paintblack.com * Copyright 2011 Juan Carlos Cornejo jc2@paintblack.com
* *
* This file is part of owncloud_sync. * This file is part of owncloud_sync_qt.
* *
* owncloud_sync is free software: you can redistribute it and/or modify * owncloud_sync is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View file

@ -3,8 +3,8 @@ Encoding=UTF-8
Version=1.0 Version=1.0
Type=Application Type=Application
Terminal=false Terminal=false
Name=Owncloud Sync Name=Owncloud Sync Qt
Exec=/usr/bin/owncloud_sync Exec=/usr/bin/owncloud_sync_qt
Icon=owncloud_sync Icon=owncloud_sync
X-Window-Icon= X-Window-Icon=
X-HildonDesk-ShowInToolbar=true X-HildonDesk-ShowInToolbar=true

View file

@ -13,7 +13,7 @@ unix:!macx:!symbian: {
INCLUDEPATH += /usr/include/kde4 INCLUDEPATH += /usr/include/kde4
} }
TARGET = owncloud_sync TARGET = owncloud_sync_qt
TEMPLATE = app TEMPLATE = app
@ -21,14 +21,13 @@ SOURCES += main.cpp\
sqlite3_util.cpp \ sqlite3_util.cpp \
SyncWindow.cpp \ SyncWindow.cpp \
qwebdav/QWebDAV.cpp \ qwebdav/QWebDAV.cpp \
OwnCloudSync.cpp \ OwnCloudSync.cpp
SyncDebug.cpp
HEADERS += sqlite3_util.h \ HEADERS += sqlite3_util.h \
SyncWindow.h \ SyncWindow.h \
qwebdav/QWebDAV.h \ qwebdav/QWebDAV.h \
OwnCloudSync.h \ OwnCloudSync.h \
SyncDebug.h SyncGlobal.h
FORMS += SyncWindow.ui FORMS += SyncWindow.ui
INCLUDEPATH += qwebdav/ INCLUDEPATH += qwebdav/
@ -86,3 +85,6 @@ OTHER_FILES += \

View file

@ -4,5 +4,7 @@
<file>images/owncloud_sync.png</file> <file>images/owncloud_sync.png</file>
<file>images/owncloud_conflict.png</file> <file>images/owncloud_conflict.png</file>
<file>images/owncloud_sync_conflict.png</file> <file>images/owncloud_sync_conflict.png</file>
<file>images/pause-big.png</file>
<file>images/play-big.png</file>
</qresource> </qresource>
</RCC> </RCC>

View file

@ -1,7 +1,7 @@
/****************************************************************************** /******************************************************************************
* Copyright 2011 Juan Carlos Cornejo jc2@paintblack.com * Copyright 2011 Juan Carlos Cornejo jc2@paintblack.com
* *
* This file is part of owncloud_sync. * This file is part of owncloud_sync_qt.
* *
* owncloud_sync is free software: you can redistribute it and/or modify * owncloud_sync is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -17,7 +17,7 @@
* along with owncloud_sync. If not, see <http://www.gnu.org/licenses/>. * along with owncloud_sync. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/ ******************************************************************************/
#include "SyncDebug.h" #include "SyncGlobal.h"
#include "QWebDAV.h" #include "QWebDAV.h"
// Qt Standard Includes // Qt Standard Includes

View file

@ -1,7 +1,7 @@
/****************************************************************************** /******************************************************************************
* Copyright 2011 Juan Carlos Cornejo jc2@paintblack.com * Copyright 2011 Juan Carlos Cornejo jc2@paintblack.com
* *
* This file is part of owncloud_sync. * This file is part of owncloud_sync_qt.
* *
* owncloud_sync is free software: you can redistribute it and/or modify * owncloud_sync is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by