mirror of
https://github.com/nextcloud/desktop.git
synced 2025-10-26 11:17:43 +00:00
Patch sent in by Alvaro Soliverez: Add a "upload" button to the
Status dialog to solve conflict situations from local -> cloud
This commit is contained in:
parent
bf40e0aafc
commit
180c06b39e
@ -55,6 +55,9 @@ Application::Application(int argc, char **argv) :
|
||||
|
||||
connect( _statusDialog, SIGNAL(fetchFolderAlias(const QString&)),
|
||||
SLOT(slotFetchFolder( const QString&)));
|
||||
|
||||
connect( _statusDialog, SIGNAL(pushFolderAlias(const QString&)),
|
||||
SLOT(slotPushFolder( const QString&)));
|
||||
|
||||
setupActions();
|
||||
setupSystemTray();
|
||||
@ -288,6 +291,30 @@ void Application::slotFetchFolder( const QString& alias )
|
||||
|
||||
}
|
||||
|
||||
void Application::slotPushFolder( const QString& alias )
|
||||
{
|
||||
qDebug() << "start to push folder with alias " << alias;
|
||||
|
||||
if( ! _folderMap.contains( alias ) ) {
|
||||
qDebug() << "!! Can not push alias " << alias << ", can not be found in folderMap.";
|
||||
return;
|
||||
}
|
||||
|
||||
Folder *f = _folderMap[alias];
|
||||
|
||||
if( f->backend() == "sitecopy" ) {
|
||||
if( QMessageBox::question( 0, tr("Confirm Folder Push"), tr("Do you really want to push the folder with alias <i>%1</i> to your ownCloud?<br/>"
|
||||
"This overwrites your remote data with data in directory <i>%2</i>!").arg(alias).arg(f->path()),
|
||||
QMessageBox::Yes|QMessageBox::No ) == QMessageBox::Yes ) {
|
||||
SiteCopyFolder *sf = static_cast<SiteCopyFolder*>( f );
|
||||
sf->pushToOC();
|
||||
} else {
|
||||
qDebug() << "!! Can only fetch backend type sitecopy, this one has " << f->backend();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Application::slotConfigure()
|
||||
{
|
||||
setAllFolderSyncEnabled( false );
|
||||
|
||||
@ -47,6 +47,7 @@ protected slots:
|
||||
void slotAddFolder();
|
||||
void slotRemoveFolder( const QString& );
|
||||
void slotFetchFolder( const QString& );
|
||||
void slotPushFolder( const QString& );
|
||||
void slotConfigure();
|
||||
|
||||
void slotFolderSyncStarted();
|
||||
|
||||
@ -95,6 +95,15 @@ void SiteCopyFolder::fetchFromOC()
|
||||
startSiteCopy( "--fetch", Sync );
|
||||
}
|
||||
|
||||
void SiteCopyFolder::pushToOC()
|
||||
{
|
||||
QMutexLocker locker( &_syncMutex );
|
||||
qDebug() << "starting to sync to ownCloud";
|
||||
setSyncEnabled( true );
|
||||
|
||||
startSiteCopy( "--update", Sync );
|
||||
}
|
||||
|
||||
void SiteCopyFolder::startSiteCopy( const QString& command, SiteCopyState nextState )
|
||||
{
|
||||
if( _SiteCopy->state() == QProcess::Running ) {
|
||||
|
||||
@ -42,6 +42,9 @@ public:
|
||||
|
||||
// load data from ownCloud to the local directory.
|
||||
void fetchFromOC();
|
||||
|
||||
// push data from the local directory to ownCloud
|
||||
void pushToOC();
|
||||
|
||||
virtual bool isBusy() const;
|
||||
|
||||
|
||||
@ -119,11 +119,13 @@ StatusDialog::StatusDialog(QWidget *parent) :
|
||||
connect(_ButtonClose, SIGNAL(clicked()), this, SLOT(accept()));
|
||||
connect(_ButtonRemove, SIGNAL(clicked()), this, SLOT(slotRemoveFolder()));
|
||||
connect(_ButtonFetch, SIGNAL(clicked()), this, SLOT(slotFetchFolder()));
|
||||
connect(_ButtonPush, SIGNAL(clicked()), this, SLOT(slotPushFolder()));
|
||||
connect(_ButtonOpenOC, SIGNAL(clicked()), this, SLOT(slotOpenOC()));
|
||||
|
||||
_ButtonOpenOC->setEnabled(false);
|
||||
_ButtonRemove->setEnabled(false);
|
||||
_ButtonFetch->setEnabled(false);
|
||||
_ButtonPush->setEnabled(false);
|
||||
|
||||
connect(_folderList, SIGNAL(activated(QModelIndex)), SLOT(slotFolderActivated(QModelIndex)));
|
||||
}
|
||||
@ -134,6 +136,7 @@ void StatusDialog::slotFolderActivated( const QModelIndex& indx )
|
||||
|
||||
_ButtonRemove->setEnabled( state );
|
||||
_ButtonFetch->setEnabled( state );
|
||||
_ButtonPush->setEnabled( state );
|
||||
|
||||
}
|
||||
|
||||
@ -198,6 +201,18 @@ void StatusDialog::slotFetchFolder()
|
||||
}
|
||||
}
|
||||
|
||||
void StatusDialog::slotPushFolder()
|
||||
{
|
||||
QModelIndex selected = _folderList->selectionModel()->currentIndex();
|
||||
if( selected.isValid() ) {
|
||||
QString alias = _model->data( selected, FolderViewDelegate::FolderNameRole ).toString();
|
||||
qDebug() << "Push Folder alias " << alias;
|
||||
if( !alias.isEmpty() ) {
|
||||
emit(pushFolderAlias( alias ));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void StatusDialog::setOCUrl( const QUrl& url )
|
||||
{
|
||||
_OCUrl = url;
|
||||
|
||||
@ -53,10 +53,12 @@ public:
|
||||
signals:
|
||||
void removeFolderAlias( const QString& );
|
||||
void fetchFolderAlias( const QString& );
|
||||
void pushFolderAlias( const QString& );
|
||||
|
||||
public slots:
|
||||
void slotRemoveFolder();
|
||||
void slotFetchFolder();
|
||||
void slotPushFolder();
|
||||
void slotFolderActivated( const QModelIndex& );
|
||||
void slotOpenOC();
|
||||
|
||||
|
||||
@ -51,6 +51,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="_ButtonPush">
|
||||
<property name="text">
|
||||
<string>push...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user