Skip to content

Commit

Permalink
for Google drive added option to browse trash (--drive-trashed-only) #82
Browse files Browse the repository at this point in the history
  • Loading branch information
kapitainsky committed Mar 2, 2020
1 parent ae18f36 commit 9d59787
Show file tree
Hide file tree
Showing 11 changed files with 475 additions and 256 deletions.
22 changes: 19 additions & 3 deletions src/job_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ JobOptions::JobOptions()
dontUpdateModified(false), maxDepth(0), deleteExcluded(false),
isFolder(false) {}

const qint32 JobOptions::classVersion = 3;
const qint32 JobOptions::classVersion = 4;

JobOptions::~JobOptions() {}

Expand Down Expand Up @@ -145,8 +145,24 @@ QStringList JobOptions::getOptions() const {
}
}

if (DriveSharedWithMe) {
list << "--drive-shared-with-me";
// get Google Drive mode option
if (remoteType == "drive") {
if (remoteMode == "shared") {
list << "--drive-shared-with-me";
} else {
if (remoteMode == "trash") {
list << "--drive-trashed-only";
} else {
if (remoteMode == "main") {
} else {
// older tasks dont't have googleDriveMode
// and value from DriveSharedWithMe has to be used
if (DriveSharedWithMe) {
list << "--drive-shared-with-me";
}
}
}
}
}

list << "--stats"
Expand Down
2 changes: 2 additions & 0 deletions src/job_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ class JobOptions {
bool isFolder;
QUuid uniqueId;
bool DriveSharedWithMe;
QString remoteMode;
QString remoteType;

void setJobType(bool isDownload) {
jobType = (isDownload) ? Download : Upload;
Expand Down
13 changes: 9 additions & 4 deletions src/list_of_job_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ QDataStream &operator<<(QDataStream &stream, JobOptions &jo) {
<< jo.connectTimeout << jo.idleTimeout << jo.retries
<< jo.lowLevelRetries << jo.deleteExcluded << jo.excluded << jo.extra
<< jo.DriveSharedWithMe << jo.source << jo.dest << jo.isFolder
<< jo.uniqueId;
<< jo.uniqueId << jo.remoteMode << jo.remoteType;

return stream;
}
Expand Down Expand Up @@ -184,9 +184,14 @@ QDataStream &operator>>(QDataStream &stream, JobOptions &jo) {
// stream value
if (actualVersion >= 2) {
stream >> jo.isFolder;
if (actualVersion >= 3) {
stream >> jo.uniqueId;
}
}

if (actualVersion >= 3) {
stream >> jo.uniqueId;
}
if (actualVersion >= 4) {
stream >> jo.remoteMode;
stream >> jo.remoteType;
}

return stream;
Expand Down
12 changes: 12 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,18 @@ int main(int argc, char *argv[]) {
settings->setValue("Settings/sortTask", "false");
};

// during first run the remoteMode key might not exist
if (!(settings->contains("Settings/remoteMode"))) {
// if remoteMode does not exist create new key
settings->setValue("Settings/remoteMode", "main");
};

// during first run the remoteType key might not exist
if (!(settings->contains("Settings/remoteType"))) {
// if remoteType does not exist create new key
settings->setValue("Settings/remoteType", "main");
};

// set application font size
int fontsize = 0;

Expand Down
8 changes: 6 additions & 2 deletions src/main_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1427,12 +1427,16 @@ void MainWindow::editSelectedTask() {

JobOptions *jo = item->GetData();
bool isDownload = (jo->jobType == JobOptions::Download);
QString remoteType = (jo->remoteType);
QString remoteMode = (jo->remoteMode);

QString remote = isDownload ? jo->source : jo->dest;
QString path = isDownload ? jo->dest : jo->source;
// qDebug() << "remote:" + remote;
// qDebug() << "path:" + path;
TransferDialog td(isDownload, false, remote, path, jo->isFolder, this, jo,
true);

TransferDialog td(isDownload, false, remote, path, jo->isFolder, remoteType,
remoteMode, this, jo, true);
td.exec();
}

Expand Down
Loading

0 comments on commit 9d59787

Please sign in to comment.