@@ -26,6 +26,7 @@ RemoteWidget::RemoteWidget(IconCache* iconCache, const QString& remote, bool isL
2626 ui.refresh ->setIcon (style->standardIcon (QStyle::SP_BrowserReload));
2727 ui.mkdir ->setIcon (style->standardIcon (QStyle::SP_FileDialogNewFolder));
2828 ui.rename ->setIcon (style->standardIcon (QStyle::SP_FileIcon));
29+ ui.move ->setIcon (style->standardIcon (QStyle::SP_DirOpenIcon));
2930 ui.purge ->setIcon (style->standardIcon (QStyle::SP_TrashIcon));
3031 ui.mount ->setIcon (style->standardIcon (QStyle::SP_DirLinkIcon));
3132 ui.stream ->setIcon (style->standardIcon (QStyle::SP_MediaPlay));
@@ -38,6 +39,7 @@ RemoteWidget::RemoteWidget(IconCache* iconCache, const QString& remote, bool isL
3839 ui.buttonRefresh ->setDefaultAction (ui.refresh );
3940 ui.buttonMkdir ->setDefaultAction (ui.mkdir );
4041 ui.buttonRename ->setDefaultAction (ui.rename );
42+ ui.buttonMove ->setDefaultAction (ui.move );
4143 ui.buttonPurge ->setDefaultAction (ui.purge );
4244 ui.buttonMount ->setDefaultAction (ui.mount );
4345 ui.buttonStream ->setDefaultAction (ui.stream );
@@ -82,6 +84,7 @@ RemoteWidget::RemoteWidget(IconCache* iconCache, const QString& remote, bool isL
8284 if (model->isLoading (index))
8385 {
8486 ui.refresh ->setDisabled (true );
87+ ui.move ->setDisabled (true );
8588 ui.rename ->setDisabled (true );
8689 ui.purge ->setDisabled (true );
8790 ui.mount ->setDisabled (true );
@@ -92,6 +95,7 @@ RemoteWidget::RemoteWidget(IconCache* iconCache, const QString& remote, bool isL
9295 {
9396 ui.refresh ->setDisabled (false );
9497 ui.rename ->setDisabled (topLevel);
98+ ui.move ->setDisabled (topLevel);
9599 ui.purge ->setDisabled (topLevel);
96100 ui.mount ->setDisabled (!isFolder);
97101 ui.stream ->setDisabled (isFolder);
@@ -168,6 +172,35 @@ RemoteWidget::RemoteWidget(IconCache* iconCache, const QString& remote, bool isL
168172 }
169173 });
170174
175+ QObject::connect (ui.move , &QAction::triggered, this , [=]()
176+ {
177+ QModelIndex index = ui.tree ->selectionModel ()->selectedRows ().front ();
178+
179+ QString path = model->path (index).path ();
180+ QString pathMsg = isLocal ? QDir::toNativeSeparators (path) : path;
181+
182+ QString name = model->path (index.parent ()).path () + " /" ;
183+ name = QInputDialog::getText (this , " Move" , QString (" New location for %1" ).arg (pathMsg), QLineEdit::Normal, name);
184+ if (!name.isEmpty ())
185+ {
186+ QProcess process;
187+ UseRclonePassword (&process);
188+ process.setProgram (GetRclone ());
189+ process.setArguments (QStringList ()
190+ << " move"
191+ << GetRcloneConf ()
192+ << remote + " :" + path
193+ << remote + " :" + name);
194+ process.setReadChannelMode (QProcess::MergedChannels);
195+
196+ ProgressDialog progress (" Move" , " Moving..." , pathMsg, &process, this );
197+ if (progress.exec () == QDialog::Accepted)
198+ {
199+ model->refresh (index);
200+ }
201+ }
202+ });
203+
171204 QObject::connect (ui.purge , &QAction::triggered, this , [=]()
172205 {
173206 QModelIndex index = ui.tree ->selectionModel ()->selectedRows ().front ();
@@ -376,6 +409,7 @@ RemoteWidget::RemoteWidget(IconCache* iconCache, const QString& remote, bool isL
376409 menu.addSeparator ();
377410 menu.addAction (ui.mkdir );
378411 menu.addAction (ui.rename );
412+ menu.addAction (ui.move );
379413 menu.addAction (ui.purge );
380414 menu.addSeparator ();
381415 menu.addAction (ui.mount );
0 commit comments