From 88960556e3217a265496617c9106f17d614bc730 Mon Sep 17 00:00:00 2001 From: Nick Tiskov Date: Tue, 22 Jan 2013 15:38:09 +0400 Subject: [PATCH 1/3] Raise main window when starting another instance w/o params --- src/main.cpp | 2 ++ src/mainwindow.cpp | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index 3803e4ce2..79950e74c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -197,6 +197,8 @@ int main(int argc, char *argv[]) { qDebug("Passing program parameters to running instance..."); qDebug("Message: %s", qPrintable(message)); app.sendMessage(message); + } else { // Raise main window + app.sendMessage("qbt://show"); } return 0; } diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 43a5383c0..dec5e3ca2 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -960,6 +960,14 @@ void MainWindow::processParams(const QStringList& params) { if (misc::isUrl(param)) { QBtSession::instance()->downloadFromUrl(param); }else{ + if(param.startsWith("qbt://show", Qt::CaseInsensitive)) { + if(!ui_locked) { + show(); + activateWindow(); + raise(); + } + return; // Do not process more params + } if (param.startsWith("bc://bt/", Qt::CaseInsensitive)) { qDebug("Converting bc link to magnet link"); param = misc::bcLinkToMagnet(param); From 5ca5441a48df98bd2c1212aeb26ac0d50f96cd30 Mon Sep 17 00:00:00 2001 From: Nick Tiskov Date: Tue, 22 Jan 2013 17:36:14 +0400 Subject: [PATCH 2/3] Support raising window when UI is locked --- src/mainwindow.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index dec5e3ca2..ecc20aa49 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -961,11 +961,13 @@ void MainWindow::processParams(const QStringList& params) { QBtSession::instance()->downloadFromUrl(param); }else{ if(param.startsWith("qbt://show", Qt::CaseInsensitive)) { - if(!ui_locked) { - show(); - activateWindow(); - raise(); + if(ui_locked) { + if(!unlockUI()) + return; } + show(); + activateWindow(); + raise(); return; // Do not process more params } if (param.startsWith("bc://bt/", Qt::CaseInsensitive)) { From 1090e87f3a491e65bfd806ce3f5ce27865151b0a Mon Sep 17 00:00:00 2001 From: Nick Tiskov Date: Sat, 26 Jan 2013 22:22:17 +0400 Subject: [PATCH 3/3] fixup! Raise main window when starting another instance w/o params --- src/mainwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index ecc20aa49..842c8e52a 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -960,7 +960,7 @@ void MainWindow::processParams(const QStringList& params) { if (misc::isUrl(param)) { QBtSession::instance()->downloadFromUrl(param); }else{ - if(param.startsWith("qbt://show", Qt::CaseInsensitive)) { + if(param.startsWith("qbt://show")) { if(ui_locked) { if(!unlockUI()) return;