# # # patch "src/view/dialogs/OpenPrompt.cpp" # from [c2fdd76bcbaa302fcbbe313a5299595a3e4010c9] # to [ea8129b7e3f6d06cf860b9ee4e9690332e0c8934] # # patch "src/view/mainwindows/MainWindow.cpp" # from [b5e62ce1fccd01cbe21fe85322a17cd521bf4346] # to [ead6ecaeca3f8645f5d71333fc501c147fffd1f8] # # patch "src/view/widgets/MenuBar.cpp" # from [67c074a4d91ed3a9fd9a89eece0346fecb32fbd5] # to [24674587777e567a8b9ca191db096e1cc777ddd5] # ============================================================ --- src/view/dialogs/OpenPrompt.cpp c2fdd76bcbaa302fcbbe313a5299595a3e4010c9 +++ src/view/dialogs/OpenPrompt.cpp ea8129b7e3f6d06cf860b9ee4e9690332e0c8934 @@ -136,7 +136,7 @@ void OpenPrompt::recentServersChanged(in { // skip the first dummy item if (idx < 1) return; - emit loadFromString(recentServers->itemText(idx)); + emit loadFromString(recentServers->itemData(idx).toString()); } void OpenPrompt::loadFromStringFailed(const QString & source, const QString & errmsg) @@ -144,7 +144,7 @@ void OpenPrompt::loadFromStringFailed(co QMessageBox::critical( NULL, tr("Failed to load source"), - tr("The source '%1' could not be loaded:\n%1") + tr("The source '%1' could not be loaded:\n%2") .arg(source).arg(errmsg), QMessageBox::Ok ); @@ -182,7 +182,17 @@ void OpenPrompt::updateRecentLists() if (servers.size() > 0) { - recentServers->addItems(servers); + int c = 0; + QRegExp rx("^mtn://(?:(\\w*)@)?([\\w\\-]+(?:\\.[\\w\\-]+)*(?::\\d+)?)$"); + foreach (const QString & server, servers) + { + QString label = server; + if (rx.indexIn(label) != -1) + { + label = QString("%1 (%2...)").arg(rx.cap(2)).arg(rx.cap(1).left(8)); + } + recentServers->insertItem(++c, label, server); + } recentServers->setEnabled(true); } else ============================================================ --- src/view/mainwindows/MainWindow.cpp b5e62ce1fccd01cbe21fe85322a17cd521bf4346 +++ src/view/mainwindows/MainWindow.cpp ead6ecaeca3f8645f5d71333fc501c147fffd1f8 @@ -182,7 +182,7 @@ void MainWindow::loadFromStringFailed(co QMessageBox::critical( NULL, tr("Failed to load source"), - tr("The source '%1' could not be loaded:\n%1") + tr("The source '%1' could not be loaded:\n%2") .arg(source).arg(errmsg), QMessageBox::Ok ); ============================================================ --- src/view/widgets/MenuBar.cpp 67c074a4d91ed3a9fd9a89eece0346fecb32fbd5 +++ src/view/widgets/MenuBar.cpp 24674587777e567a8b9ca191db096e1cc777ddd5 @@ -226,11 +226,18 @@ void MenuBar::updateRecentLists() } else { + QRegExp rx("^mtn://(?:(\\w*)@)?([\\w\\-]+(?:\\.[\\w\\-]+)*(?::\\d+)?)$"); QAction * act; for (int i = 0; i < elemCount; ++i) { + QString label = previousServers[i]; + if (rx.indexIn(label) != -1) + { + label = QString("%1 (%2...)").arg(rx.cap(2)).arg(rx.cap(1).left(8)); + } + act = menuRecent_Servers->addAction( - tr("&%1 %2").arg(i + 1).arg(previousServers[i]), + tr("&%1 %2").arg(i + 1).arg(label), this, SLOT(connectRecentServer()) );