mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-27 17:37:36 +03:00
Give application class control over itemprogressdialog
This commit is contained in:
parent
8d9b4d3669
commit
6ce1c17ee1
10 changed files with 26 additions and 30 deletions
|
@ -633,25 +633,7 @@ void AccountSettings::slotIgnoreFilesEditor()
|
|||
|
||||
void AccountSettings::slotInfoAboutCurrentFolder()
|
||||
{
|
||||
QModelIndex selected = ui->_folderList->selectionModel()->currentIndex();
|
||||
if( selected.isValid() ) {
|
||||
QString alias = _model->data( selected, FolderStatusDelegate::FolderAliasRole ).toString();
|
||||
qDebug() << "Info Folder alias " << alias;
|
||||
if( !alias.isEmpty() ) {
|
||||
|
||||
qDebug() << "details of folder with alias " << alias;
|
||||
|
||||
if( _fileItemDialog.isNull() ) {
|
||||
_fileItemDialog = new ItemProgressDialog(this);
|
||||
_fileItemDialog->open();
|
||||
_fileItemDialog->setupList();
|
||||
} else {
|
||||
Utility::raiseDialog( _fileItemDialog );
|
||||
}
|
||||
|
||||
// _fileItemDialog->setSyncResult( FolderMan::instance()->syncResult( alias ) );
|
||||
}
|
||||
}
|
||||
emit(openProgressDialog());
|
||||
}
|
||||
|
||||
AccountSettings::~AccountSettings()
|
||||
|
|
|
@ -55,6 +55,7 @@ public:
|
|||
|
||||
signals:
|
||||
void folderChanged();
|
||||
void openProgressDialog();
|
||||
void openFolderAlias( const QString& );
|
||||
void infoFolderAlias( const QString& );
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include "mirall/credentialstore.h"
|
||||
#include "mirall/logger.h"
|
||||
#include "mirall/settingsdialog.h"
|
||||
#include "mirall/itemprogressdialog.h"
|
||||
#include "mirall/utility.h"
|
||||
#include "mirall/inotify.h"
|
||||
#include "mirall/connectionvalidator.h"
|
||||
|
@ -292,7 +293,7 @@ void Application::setupActions()
|
|||
_actionRecent = new QAction(tr("more..."), this);
|
||||
_actionRecent->setEnabled( true );
|
||||
|
||||
QObject::connect(_actionRecent, SIGNAL(triggered(bool)), SLOT(slotShowRecentChanges()));
|
||||
QObject::connect(_actionRecent, SIGNAL(triggered(bool)), SLOT(slotItemProgressDialog()));
|
||||
QObject::connect(_actionSettings, SIGNAL(triggered(bool)), SLOT(slotSettings()));
|
||||
_actionHelp = new QAction(tr("Help"), this);
|
||||
QObject::connect(_actionHelp, SIGNAL(triggered(bool)), SLOT(slotHelp()));
|
||||
|
@ -637,11 +638,6 @@ void Application::slotFoldersChanged()
|
|||
setupContextMenu();
|
||||
}
|
||||
|
||||
void Application::slotShowRecentChanges()
|
||||
{
|
||||
// not yet here.
|
||||
}
|
||||
|
||||
void Application::slotSettings()
|
||||
{
|
||||
if (_settingsDialog.isNull()) {
|
||||
|
@ -652,6 +648,16 @@ void Application::slotSettings()
|
|||
Utility::raiseDialog(_settingsDialog);
|
||||
}
|
||||
|
||||
void Application::slotItemProgressDialog()
|
||||
{
|
||||
if (_progressDialog.isNull()) {
|
||||
_progressDialog = new ItemProgressDialog(this);
|
||||
_progressDialog->setAttribute( Qt::WA_DeleteOnClose, true );
|
||||
_progressDialog->open();
|
||||
}
|
||||
Utility::raiseDialog(_progressDialog);
|
||||
}
|
||||
|
||||
void Application::slotParseOptions(const QString &opts)
|
||||
{
|
||||
QStringList options = opts.split(QLatin1Char('|'));
|
||||
|
|
|
@ -44,6 +44,7 @@ class FolderWizard;
|
|||
class ownCloudInfo;
|
||||
class SslErrorDialog;
|
||||
class SettingsDialog;
|
||||
class ItemProgressDialog;
|
||||
|
||||
class Application : public SharedTools::QtSingleApplication
|
||||
{
|
||||
|
@ -84,6 +85,7 @@ protected slots:
|
|||
void slotFoldersChanged();
|
||||
void slotCheckConfig();
|
||||
void slotSettings();
|
||||
void slotItemProgressDialog();
|
||||
void slotParseOptions( const QString& );
|
||||
void slotShowTrayMessage(const QString&, const QString&);
|
||||
void slotShowOptionalTrayMessage(const QString&, const QString&);
|
||||
|
@ -103,7 +105,6 @@ protected slots:
|
|||
void slotProgressSyncProblem(const QString& folder, const Progress::SyncProblem &problem);
|
||||
void slotDisplayIdle();
|
||||
void slotHelp();
|
||||
void slotShowRecentChanges();
|
||||
private:
|
||||
void setHelp();
|
||||
void raiseDialog( QWidget* );
|
||||
|
@ -132,6 +133,8 @@ private:
|
|||
QSignalMapper *_folderOpenActionMapper;
|
||||
LogBrowser *_logBrowser;
|
||||
QPointer<SettingsDialog> _settingsDialog;
|
||||
QPointer<ItemProgressDialog> _progressDialog;
|
||||
|
||||
QString _logFile;
|
||||
QString _logDirectory;
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
namespace Mirall {
|
||||
|
||||
ItemProgressDialog::ItemProgressDialog(QWidget *parent) :
|
||||
ItemProgressDialog::ItemProgressDialog(Application*, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
_ui(new Ui::ItemProgressDialog),
|
||||
ErrorIndicatorRole( Qt::UserRole +1 )
|
||||
|
@ -210,7 +210,7 @@ void ItemProgressDialog::slotProgressErrors( const QString& folder, const Progre
|
|||
|
||||
QTreeWidgetItem *item = new QTreeWidgetItem(folderItem, columns);
|
||||
item->setData(0, ErrorIndicatorRole, QVariant(true) );
|
||||
_problemCounter++;
|
||||
item->setIcon(0, Theme::instance()->syncStateIcon(SyncResult::Problem, true));
|
||||
|
||||
Q_UNUSED(item);
|
||||
}
|
||||
|
|
|
@ -27,12 +27,13 @@ class SyncResult;
|
|||
namespace Ui {
|
||||
class ItemProgressDialog;
|
||||
}
|
||||
class Application;
|
||||
|
||||
class ItemProgressDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ItemProgressDialog(QWidget *parent = 0);
|
||||
explicit ItemProgressDialog(Application *app, QWidget *parent = 0);
|
||||
~ItemProgressDialog();
|
||||
|
||||
void setupList();
|
||||
|
|
|
@ -77,6 +77,7 @@ SettingsDialog::SettingsDialog(Application *app, QWidget *parent) :
|
|||
connect( _accountSettings, SIGNAL(folderChanged()), app, SLOT(slotFoldersChanged()));
|
||||
connect( _accountSettings, SIGNAL(openFolderAlias(const QString&)),
|
||||
app, SLOT(slotFolderOpenAction(QString)));
|
||||
connect( _accountSettings, SIGNAL(openProgressDialog()), app, SLOT(slotItemProgressDialog()));
|
||||
|
||||
connect( ProgressDispatcher::instance(), SIGNAL(progressInfo(QString, Progress::Info)),
|
||||
_accountSettings, SLOT(slotSetProgress(QString, Progress::Info)) );
|
||||
|
|
|
@ -34,6 +34,7 @@ public:
|
|||
SyncPrepare,
|
||||
SyncRunning,
|
||||
Success,
|
||||
Problem,
|
||||
Error,
|
||||
SetupError,
|
||||
Unavailable
|
||||
|
|
|
@ -223,6 +223,8 @@ QIcon Theme::syncStateIcon( SyncResult::Status status, bool sysTray ) const
|
|||
case SyncResult::Success:
|
||||
statusIcon = QLatin1String("state-ok");
|
||||
break;
|
||||
case SyncResult::Problem:
|
||||
statusIcon = QLatin1String("state-error"); // FIXME: Use state-problem once we have an icon.
|
||||
case SyncResult::Error:
|
||||
case SyncResult::SetupError:
|
||||
default:
|
||||
|
|
|
@ -82,7 +82,6 @@ public:
|
|||
virtual QIcon syncStateIcon( SyncResult::Status, bool sysTray = false ) const;
|
||||
|
||||
virtual QIcon folderDisabledIcon() const = 0;
|
||||
|
||||
virtual QIcon applicationIcon() const = 0;
|
||||
|
||||
virtual QString statusHeaderText( SyncResult::Status ) const;
|
||||
|
|
Loading…
Reference in a new issue