@@ -13,10 +13,7 @@ RemoteWidget::RemoteWidget(IconCache* iconCache, const QString& remote, bool isL
1313
1414 QString root = isLocal ? " /" : QString ();
1515
16- #ifdef Q_OS_WIN32
17- ui.mount ->setVisible (false );
18- ui.buttonMount ->setVisible (false );
19- #else
16+ #ifndef Q_OS_WIN32
2017 isLocal = false ;
2118#endif
2219 auto settings = GetSettings ();
@@ -26,6 +23,7 @@ RemoteWidget::RemoteWidget(IconCache* iconCache, const QString& remote, bool isL
2623 ui.refresh ->setIcon (style->standardIcon (QStyle::SP_BrowserReload));
2724 ui.mkdir ->setIcon (style->standardIcon (QStyle::SP_FileDialogNewFolder));
2825 ui.rename ->setIcon (style->standardIcon (QStyle::SP_FileIcon));
26+ ui.move ->setIcon (style->standardIcon (QStyle::SP_DirOpenIcon));
2927 ui.purge ->setIcon (style->standardIcon (QStyle::SP_TrashIcon));
3028 ui.mount ->setIcon (style->standardIcon (QStyle::SP_DirLinkIcon));
3129 ui.stream ->setIcon (style->standardIcon (QStyle::SP_MediaPlay));
@@ -38,6 +36,7 @@ RemoteWidget::RemoteWidget(IconCache* iconCache, const QString& remote, bool isL
3836 ui.buttonRefresh ->setDefaultAction (ui.refresh );
3937 ui.buttonMkdir ->setDefaultAction (ui.mkdir );
4038 ui.buttonRename ->setDefaultAction (ui.rename );
39+ ui.buttonMove ->setDefaultAction (ui.move );
4140 ui.buttonPurge ->setDefaultAction (ui.purge );
4241 ui.buttonMount ->setDefaultAction (ui.mount );
4342 ui.buttonStream ->setDefaultAction (ui.stream );
@@ -82,6 +81,7 @@ RemoteWidget::RemoteWidget(IconCache* iconCache, const QString& remote, bool isL
8281 if (model->isLoading (index))
8382 {
8483 ui.refresh ->setDisabled (true );
84+ ui.move ->setDisabled (true );
8585 ui.rename ->setDisabled (true );
8686 ui.purge ->setDisabled (true );
8787 ui.mount ->setDisabled (true );
@@ -92,6 +92,7 @@ RemoteWidget::RemoteWidget(IconCache* iconCache, const QString& remote, bool isL
9292 {
9393 ui.refresh ->setDisabled (false );
9494 ui.rename ->setDisabled (topLevel);
95+ ui.move ->setDisabled (topLevel);
9596 ui.purge ->setDisabled (topLevel);
9697 ui.mount ->setDisabled (!isFolder);
9798 ui.stream ->setDisabled (isFolder);
@@ -154,7 +155,7 @@ RemoteWidget::RemoteWidget(IconCache* iconCache, const QString& remote, bool isL
154155 UseRclonePassword (&process);
155156 process.setProgram (GetRclone ());
156157 process.setArguments (QStringList ()
157- << " move "
158+ << " moveto "
158159 << GetRcloneConf ()
159160 << remote + " :" + path
160161 << remote + " :" + model->path (index.parent ()).filePath (name));
@@ -168,6 +169,35 @@ RemoteWidget::RemoteWidget(IconCache* iconCache, const QString& remote, bool isL
168169 }
169170 });
170171
172+ QObject::connect (ui.move , &QAction::triggered, this , [=]()
173+ {
174+ QModelIndex index = ui.tree ->selectionModel ()->selectedRows ().front ();
175+
176+ QString path = model->path (index).path ();
177+ QString pathMsg = isLocal ? QDir::toNativeSeparators (path) : path;
178+
179+ QString name = model->path (index.parent ()).path () + " /" ;
180+ name = QInputDialog::getText (this , " Move" , QString (" New location for %1" ).arg (pathMsg), QLineEdit::Normal, name);
181+ if (!name.isEmpty ())
182+ {
183+ QProcess process;
184+ UseRclonePassword (&process);
185+ process.setProgram (GetRclone ());
186+ process.setArguments (QStringList ()
187+ << " move"
188+ << GetRcloneConf ()
189+ << remote + " :" + path
190+ << remote + " :" + name);
191+ process.setReadChannelMode (QProcess::MergedChannels);
192+
193+ ProgressDialog progress (" Move" , " Moving..." , pathMsg, &process, this );
194+ if (progress.exec () == QDialog::Accepted)
195+ {
196+ model->refresh (index);
197+ }
198+ }
199+ });
200+
171201 QObject::connect (ui.purge , &QAction::triggered, this , [=]()
172202 {
173203 QModelIndex index = ui.tree ->selectionModel ()->selectedRows ().front ();
@@ -202,7 +232,11 @@ RemoteWidget::RemoteWidget(IconCache* iconCache, const QString& remote, bool isL
202232 QString path = model->path (index).path ();
203233 QString pathMsg = isLocal ? QDir::toNativeSeparators (path) : path;
204234
235+ #ifdef Q_OS_WIN32
236+ QString folder = QInputDialog::getText (this , " Mount" , QString (" Drive to mount %1 to" ).arg (pathMsg), QLineEdit::Normal, " Z:" );
237+ #else
205238 QString folder = QFileDialog::getExistingDirectory (this , QString (" Mount %1" ).arg (pathMsg));
239+ #endif
206240 if (!folder.isEmpty ())
207241 {
208242 emit addMount (remote + " :" + path, folder);
@@ -376,6 +410,7 @@ RemoteWidget::RemoteWidget(IconCache* iconCache, const QString& remote, bool isL
376410 menu.addSeparator ();
377411 menu.addAction (ui.mkdir );
378412 menu.addAction (ui.rename );
413+ menu.addAction (ui.move );
379414 menu.addAction (ui.purge );
380415 menu.addSeparator ();
381416 menu.addAction (ui.mount );
0 commit comments