Raise main window when starting another instance w/o params

This commit is contained in:
Nick Tiskov 2013-01-22 15:38:09 +04:00
parent d3b4ec77bc
commit 88960556e3
2 changed files with 10 additions and 0 deletions

View File

@ -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;
}

View File

@ -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);