summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--collectiondatesview.cpp19
-rw-r--r--copydialog.cpp8
-rw-r--r--copydialog.h2
3 files changed, 29 insertions, 0 deletions
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<CollectionWidgetProxy*>(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();
}
diff --git a/copydialog.cpp b/copydialog.cpp
index da71494..625ccac 100644
--- a/copydialog.cpp
+++ b/copydialog.cpp
@@ -70,6 +70,14 @@ void CopyDialog::getDestination(){
mDstE->setText(dir);
}
+void CopyDialog::setSource(const QString &src){
+ mSrcE->setText(src);
+}
+
+void CopyDialog::setDestFolder(const QString &dst){
+ mFolderE->setText(dst);
+}
+
void CopyDialog::closeEvent(QCloseEvent *e){
QSettings s;
s.setValue("copydlgsize", size());
diff --git a/copydialog.h b/copydialog.h
index fd101ce..5a63515 100644
--- a/copydialog.h
+++ b/copydialog.h
@@ -13,6 +13,8 @@ class CopyDialog : public QDialog {
public slots:
void readSettings();
void getDestination();
+ void setSource(const QString &src);
+ void setDestFolder(const QString &dst);
protected:
virtual void closeEvent(QCloseEvent *e);