From 2a866788cd2608b5f893f173a611785da44d3047 Mon Sep 17 00:00:00 2001 From: Arno Date: Sat, 13 Oct 2018 04:32:51 +0200 Subject: Set source and Destination folder in CopyDialog Still does nothing, but fill the source QLineEdit with something reasonable and try to guess the destination directory. --- collectiondatesview.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'collectiondatesview.cpp') diff --git a/collectiondatesview.cpp b/collectiondatesview.cpp index 83a7c3f..5544f72 100644 --- a/collectiondatesview.cpp +++ b/collectiondatesview.cpp @@ -5,6 +5,7 @@ #include "collectiondatesview.h" #include "copydialog.h" +#include "collectionwidgetproxy.h" CollectionDatesView::CollectionDatesView(QWidget *parent) : CollectionWidget(parent){ } @@ -80,6 +81,24 @@ void CollectionDatesView::populate(){ } void CollectionDatesView::copyTo(){ + QModelIndexList sel = view()->selectionModel()->selectedRows(); + if(sel.isEmpty()){ + return; + } + QModelIndex first = sel.first(); + int type = first.data(TypeRole).toInt(); + if(type != Album){ + return; + } + CollectionWidgetProxy *proxy = static_cast(view()->model()); + QModelIndex srcIdx = proxy->mapToSource(first); + QStandardItem *item = model()->itemFromIndex(srcIdx); + QString src = QString("%1 (%2 files)").arg(srcIdx.data().toString()).arg(QString::number(item->rowCount())); CopyDialog *cdlg = new CopyDialog(this); + cdlg->setSource(src); + QString destDir = srcIdx.data().toString().toLower(); + destDir = destDir.replace(" - ", "-"); + destDir = destDir.replace(' ', '.'); + cdlg->setDestFolder(destDir); cdlg->show(); } -- cgit v1.2.3-70-g09d2