From kde-commits Thu Dec 08 00:30:30 2016 From: Nick Shaforostoff Date: Thu, 08 Dec 2016 00:30:30 +0000 To: kde-commits Subject: [ktorrent] ktorrent/dialogs: improve recent download folders list Message-Id: X-MARC-Message: https://marc.info/?l=kde-commits&m=148115704407313 Git commit 248931f76bccc340e5b049932d88acc27427e511 by Nick Shaforostoff. Committed on 08/12/2016 at 00:28. Pushed by shaforo into branch 'master'. improve recent download folders list M +17 -9 ktorrent/dialogs/fileselectdlg.cpp M +3 -3 ktorrent/dialogs/fileselectdlg.h https://commits.kde.org/ktorrent/248931f76bccc340e5b049932d88acc27427e511 diff --git a/ktorrent/dialogs/fileselectdlg.cpp b/ktorrent/dialogs/filesele= ctdlg.cpp index b7126af4..b4dc69d9 100644 --- a/ktorrent/dialogs/fileselectdlg.cpp +++ b/ktorrent/dialogs/fileselectdlg.cpp @@ -182,12 +182,18 @@ namespace kt QString cn =3D m_completedLocation->url().toLocalFile(); if (!cn.endsWith('/')) cn +=3D '/'; if (m_moveCompleted->isChecked() && !cn.isEmpty()) - move_on_completion_location_history.insert(cn); + { + move_on_completion_location_history.removeOne(cn); + move_on_completion_location_history.prepend(cn); + } = QString dn =3D m_downloadLocation->url().toLocalFile(); if (!dn.endsWith('/')) dn +=3D '/'; if (!dn.isEmpty()) - download_location_history.insert(dn); + { + download_location_history.removeOne(dn); + download_location_history.prepend(dn); + } = = QString tld =3D tc->getUserModifiedFileName(); @@ -612,10 +618,12 @@ namespace kt show_file_tree =3D g.readEntry("show_file_tree", true); m_tree->setChecked(show_file_tree); m_list->setChecked(!show_file_tree); - QStringList tmp =3D g.readEntry("download_location_history", QStri= ngList()); - download_location_history =3D QSet::fromList(tmp); - tmp =3D g.readEntry("move_on_completion_location_history", QString= List()); - move_on_completion_location_history =3D QSet::fromList(tm= p); + download_location_history =3D g.readEntry("download_location_histo= ry", QStringList()); + for (int i=3D0; igroup("FileSelectDlg"); g.writeEntry("size", size()); g.writeEntry("show_file_tree", show_file_tree); - g.writeEntry("download_location_history", download_location_histor= y.toList()); - g.writeEntry("move_on_completion_location_history", move_on_comple= tion_location_history.toList()); + g.writeEntry("download_location_history", download_location_histor= y); + g.writeEntry("move_on_completion_location_history", move_on_comple= tion_location_history); g.writeEntry("file_view", m_file_view->header()->saveState()); } = - QMenu* FileSelectDlg::createHistoryMenu(const QSet & urls, co= nst char* slot) + QMenu* FileSelectDlg::createHistoryMenu(const QStringList & urls, cons= t char* slot) { QMenu* m =3D new QMenu(this); foreach (const QString& url, urls) diff --git a/ktorrent/dialogs/fileselectdlg.h b/ktorrent/dialogs/fileselect= dlg.h index 3c0b3524..9b76882e 100644 --- a/ktorrent/dialogs/fileselectdlg.h +++ b/ktorrent/dialogs/fileselectdlg.h @@ -84,7 +84,7 @@ namespace kt void setFilter(const QString& filter); void updateExistingFiles(); void moveCompletedToggled(bool on); - QMenu* createHistoryMenu(const QSet & urls, const char* s= lot); + QMenu* createHistoryMenu(const QStringList& urls, const char* slot= ); void clearDownloadLocationHistory(); void clearMoveOnCompletionLocationHistory(); void downloadLocationHistoryTriggered(QAction* act); @@ -106,8 +106,8 @@ namespace kt kt::Group* initial_group; bool show_file_tree; QSortFilterProxyModel* filter_model; - QSet download_location_history; - QSet move_on_completion_location_history; + QStringList download_location_history; + QStringList move_on_completion_location_history; bt::Uint64 already_downloaded; }; }