2011-09-30 19:42:28 +04:00
|
|
|
/*
|
|
|
|
* Copyright (C) by Klaas Freitag <freitag@kde.org>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
|
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
* for more details.
|
|
|
|
*/
|
|
|
|
|
2011-09-26 15:12:00 +04:00
|
|
|
#ifndef STATUSDIALOG_H
|
|
|
|
#define STATUSDIALOG_H
|
|
|
|
|
|
|
|
#include <QDialog>
|
2011-10-12 18:58:54 +04:00
|
|
|
#include <QStyledItemDelegate>
|
|
|
|
#include <QStandardItemModel>
|
2011-10-20 13:48:41 +04:00
|
|
|
#include <QUrl>
|
2011-09-26 15:12:00 +04:00
|
|
|
|
2011-09-26 23:46:26 +04:00
|
|
|
#include "ui_statusdialog.h"
|
|
|
|
#include "application.h"
|
|
|
|
|
2011-09-26 17:00:12 +04:00
|
|
|
namespace Mirall {
|
|
|
|
|
2012-02-20 19:45:27 +04:00
|
|
|
class Theme;
|
2012-02-21 15:40:46 +04:00
|
|
|
class ownCloudInfo;
|
2012-02-20 19:45:27 +04:00
|
|
|
|
2012-03-08 16:40:55 +04:00
|
|
|
class FolderStatusModel : public QStandardItemModel
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
FolderStatusModel();
|
|
|
|
virtual Qt::ItemFlags flags( const QModelIndex& );
|
|
|
|
QVariant data(const QModelIndex &index, int role) const;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2011-10-12 18:58:54 +04:00
|
|
|
class FolderViewDelegate : public QStyledItemDelegate
|
|
|
|
{
|
2012-03-14 14:57:08 +04:00
|
|
|
Q_OBJECT
|
2011-10-12 18:58:54 +04:00
|
|
|
public:
|
|
|
|
FolderViewDelegate();
|
|
|
|
virtual ~FolderViewDelegate();
|
|
|
|
|
2012-03-26 15:20:15 +04:00
|
|
|
enum datarole { FolderAliasRole = Qt::UserRole + 100,
|
|
|
|
FolderPathRole = Qt::UserRole + 101,
|
|
|
|
FolderSecondPathRole = Qt::UserRole + 102,
|
|
|
|
FolderIconRole = Qt::UserRole + 103,
|
|
|
|
FolderRemotePath = Qt::UserRole + 104,
|
|
|
|
FolderStatus = Qt::UserRole + 105,
|
|
|
|
FolderErrorMsg = Qt::UserRole + 106,
|
|
|
|
FolderStatusIcon = Qt::UserRole + 107,
|
|
|
|
FolderSyncEnabled = Qt::UserRole + 108
|
2011-12-12 20:47:30 +04:00
|
|
|
};
|
2011-10-12 18:58:54 +04:00
|
|
|
void paint( QPainter*, const QStyleOptionViewItem&, const QModelIndex& ) const;
|
|
|
|
QSize sizeHint( const QStyleOptionViewItem&, const QModelIndex& ) const;
|
2012-03-08 16:40:55 +04:00
|
|
|
bool editorEvent( QEvent* event, QAbstractItemModel* model, const QStyleOptionViewItem& option,
|
|
|
|
const QModelIndex& index );
|
2011-10-12 18:58:54 +04:00
|
|
|
};
|
|
|
|
|
2012-12-20 20:35:34 +04:00
|
|
|
class StatusDialog : public QDialog, protected Ui::statusDialog
|
2011-09-26 15:12:00 +04:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2012-02-20 19:45:27 +04:00
|
|
|
explicit StatusDialog( Theme *theme, QWidget *parent = 0);
|
2012-04-10 16:51:45 +04:00
|
|
|
~StatusDialog();
|
|
|
|
|
2011-11-04 14:41:49 +04:00
|
|
|
void setFolderList( Folder::Map );
|
2012-09-19 13:57:12 +04:00
|
|
|
void buttonsSetEnabled();
|
2011-09-26 15:12:00 +04:00
|
|
|
|
|
|
|
signals:
|
2011-10-18 12:22:24 +04:00
|
|
|
void removeFolderAlias( const QString& );
|
|
|
|
void fetchFolderAlias( const QString& );
|
2011-12-05 15:01:39 +04:00
|
|
|
void pushFolderAlias( const QString& );
|
2011-12-12 20:47:30 +04:00
|
|
|
void enableFolderAlias( const QString&, const bool );
|
2012-01-24 01:10:01 +04:00
|
|
|
void infoFolderAlias( const QString& );
|
2012-03-08 15:08:53 +04:00
|
|
|
void openFolderAlias( const QString& );
|
2012-06-05 17:11:29 +04:00
|
|
|
void openLogBrowser();
|
2011-09-26 15:12:00 +04:00
|
|
|
|
2012-02-21 16:26:39 +04:00
|
|
|
/* start the add a folder wizard. */
|
|
|
|
void addASync();
|
|
|
|
|
2011-09-26 15:12:00 +04:00
|
|
|
public slots:
|
2011-09-26 23:46:26 +04:00
|
|
|
void slotRemoveFolder();
|
2012-03-29 11:41:30 +04:00
|
|
|
void slotRemoveSelectedFolder();
|
2011-10-18 12:22:24 +04:00
|
|
|
void slotFetchFolder();
|
2011-12-05 15:01:39 +04:00
|
|
|
void slotPushFolder();
|
2011-10-20 12:26:40 +04:00
|
|
|
void slotFolderActivated( const QModelIndex& );
|
2011-10-20 13:48:41 +04:00
|
|
|
void slotOpenOC();
|
2011-12-12 20:47:30 +04:00
|
|
|
void slotEnableFolder();
|
2012-01-24 01:10:01 +04:00
|
|
|
void slotInfoFolder();
|
2012-02-21 16:26:39 +04:00
|
|
|
void slotAddSync();
|
2012-03-13 18:39:04 +04:00
|
|
|
void slotAddFolder( Folder* );
|
|
|
|
void slotUpdateFolderState( Folder* );
|
2012-03-14 12:52:18 +04:00
|
|
|
void slotCheckConnection();
|
|
|
|
|
2012-04-10 22:55:50 +04:00
|
|
|
void slotOCInfoFail(QNetworkReply*);
|
2012-05-14 18:22:30 +04:00
|
|
|
void slotOCInfo( const QString&, const QString&, const QString&, const QString& );
|
2012-03-08 15:08:53 +04:00
|
|
|
void slotDoubleClicked( const QModelIndex& );
|
2012-02-21 15:40:46 +04:00
|
|
|
|
2012-03-14 12:52:18 +04:00
|
|
|
protected:
|
|
|
|
void showEvent ( QShowEvent* );
|
2011-10-12 18:58:54 +04:00
|
|
|
private:
|
2012-03-13 18:39:04 +04:00
|
|
|
void folderToModelItem( QStandardItem*, Folder* );
|
|
|
|
|
2011-10-12 18:58:54 +04:00
|
|
|
QStandardItemModel *_model;
|
2012-02-20 19:45:27 +04:00
|
|
|
QUrl _OCUrl;
|
|
|
|
Theme *_theme;
|
2011-09-26 17:00:12 +04:00
|
|
|
};
|
2012-07-26 12:16:18 +04:00
|
|
|
}
|
2011-09-26 23:46:26 +04:00
|
|
|
|
2011-09-26 15:12:00 +04:00
|
|
|
#endif // STATUSDIALOG_H
|