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-10-12 18:58:54 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <QtCore>
|
|
|
|
#include <QtGui>
|
2011-09-26 23:46:26 +04:00
|
|
|
|
2012-02-20 19:45:27 +04:00
|
|
|
#include "mirall/statusdialog.h"
|
|
|
|
#include "mirall/folder.h"
|
|
|
|
#include "mirall/theme.h"
|
2012-02-21 15:40:46 +04:00
|
|
|
#include "mirall/owncloudinfo.h"
|
2011-09-26 23:46:26 +04:00
|
|
|
|
2011-09-26 17:00:12 +04:00
|
|
|
namespace Mirall {
|
2012-03-08 16:40:55 +04:00
|
|
|
|
|
|
|
FolderStatusModel::FolderStatusModel()
|
|
|
|
:QStandardItemModel()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Qt::ItemFlags FolderStatusModel::flags ( const QModelIndex& )
|
|
|
|
{
|
|
|
|
return Qt::ItemIsSelectable;
|
|
|
|
}
|
|
|
|
|
|
|
|
QVariant FolderStatusModel::data(const QModelIndex &index, int role) const
|
|
|
|
{
|
|
|
|
if (!index.isValid())
|
|
|
|
return QVariant();
|
|
|
|
|
|
|
|
if (role == Qt::EditRole)
|
|
|
|
return QVariant();
|
|
|
|
else
|
|
|
|
return QStandardItemModel::data(index,role);
|
|
|
|
}
|
2012-03-13 18:39:04 +04:00
|
|
|
|
2012-03-08 16:40:55 +04:00
|
|
|
// ====================================================================================
|
|
|
|
|
2011-10-12 18:58:54 +04:00
|
|
|
FolderViewDelegate::FolderViewDelegate()
|
2012-03-08 15:08:53 +04:00
|
|
|
:QStyledItemDelegate()
|
2011-10-12 18:58:54 +04:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
FolderViewDelegate::~FolderViewDelegate()
|
|
|
|
{
|
|
|
|
// TODO Auto-generated destructor stub
|
|
|
|
}
|
|
|
|
|
|
|
|
//alocate each item size in listview.
|
|
|
|
QSize FolderViewDelegate::sizeHint(const QStyleOptionViewItem & option ,
|
|
|
|
const QModelIndex & index) const
|
|
|
|
{
|
2011-12-26 00:55:29 +04:00
|
|
|
int h = 70; // height 64 + 4px margin top and down
|
2011-10-12 18:58:54 +04:00
|
|
|
int w = 0;
|
|
|
|
|
|
|
|
QString p = qvariant_cast<QString>(index.data(FolderPathRole));
|
|
|
|
QFont font = QApplication::font();
|
|
|
|
QFontMetrics fm(font);
|
|
|
|
w = 8 + fm.boundingRect( p ).width();
|
|
|
|
|
|
|
|
return QSize( w, h );
|
|
|
|
}
|
|
|
|
|
|
|
|
void FolderViewDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option,
|
|
|
|
const QModelIndex &index) const
|
|
|
|
{
|
|
|
|
QStyledItemDelegate::paint(painter,option,index);
|
|
|
|
|
|
|
|
painter->save();
|
|
|
|
|
2011-10-20 12:26:40 +04:00
|
|
|
QFont font = QApplication::font();
|
2011-10-13 18:41:24 +04:00
|
|
|
QFont subFont = QApplication::font();
|
2011-10-12 18:58:54 +04:00
|
|
|
//font.setPixelSize(font.weight()+);
|
|
|
|
font.setBold(true);
|
2011-12-26 00:55:29 +04:00
|
|
|
subFont.setWeight(subFont.weight() - 4);
|
2011-10-12 18:58:54 +04:00
|
|
|
QFontMetrics fm(font);
|
|
|
|
|
|
|
|
QIcon icon = qvariant_cast<QIcon>(index.data(FolderIconRole));
|
2011-10-13 18:41:24 +04:00
|
|
|
QIcon statusIcon = qvariant_cast<QIcon>(index.data(FolderStatusIcon));
|
2012-03-13 18:39:04 +04:00
|
|
|
QString aliasText = qvariant_cast<QString>(index.data(FolderAliasRole));
|
2011-10-12 18:58:54 +04:00
|
|
|
QString pathText = qvariant_cast<QString>(index.data(FolderPathRole));
|
2011-10-13 18:41:24 +04:00
|
|
|
QString statusText = qvariant_cast<QString>(index.data(FolderStatus));
|
2011-12-26 00:55:29 +04:00
|
|
|
bool syncEnabled = index.data(FolderSyncEnabled).toBool();
|
|
|
|
QString syncStatus = syncEnabled? tr( "Enabled" ) : tr( "Disabled" );
|
2011-10-12 18:58:54 +04:00
|
|
|
|
2011-10-20 12:26:40 +04:00
|
|
|
QSize iconsize(48,48); // = icon.actualSize(option.decorationSize);
|
2011-10-12 18:58:54 +04:00
|
|
|
|
|
|
|
QRect headerRect = option.rect;
|
2011-12-26 00:55:29 +04:00
|
|
|
QRect iconRect = option.rect;
|
2011-10-12 18:58:54 +04:00
|
|
|
|
|
|
|
iconRect.setRight(iconsize.width()+30);
|
|
|
|
iconRect.setTop(iconRect.top()+5);
|
|
|
|
headerRect.setLeft(iconRect.right());
|
|
|
|
headerRect.setTop(headerRect.top()+5);
|
|
|
|
headerRect.setBottom(headerRect.top()+fm.height());
|
|
|
|
|
2011-12-26 00:55:29 +04:00
|
|
|
QRect subheaderRect = headerRect;
|
2011-10-13 18:41:24 +04:00
|
|
|
subheaderRect.setTop(headerRect.bottom());
|
|
|
|
QFontMetrics fmSub( subFont );
|
|
|
|
subheaderRect.setBottom(subheaderRect.top()+fmSub.height());
|
|
|
|
QRect statusRect = subheaderRect;
|
2011-12-26 00:55:29 +04:00
|
|
|
statusRect.setTop( subheaderRect.bottom() + 5);
|
2011-10-13 18:41:24 +04:00
|
|
|
statusRect.setBottom( statusRect.top() + fmSub.height());
|
2011-10-12 18:58:54 +04:00
|
|
|
|
2011-12-26 00:55:29 +04:00
|
|
|
QRect lastSyncRect = statusRect;
|
|
|
|
lastSyncRect.setTop( statusRect.bottom());
|
|
|
|
lastSyncRect.setBottom( lastSyncRect.top() + fmSub.height());
|
|
|
|
|
2011-10-12 18:58:54 +04:00
|
|
|
//painter->drawPixmap(QPoint(iconRect.right()/2,iconRect.top()/2),icon.pixmap(iconsize.width(),iconsize.height()));
|
2011-10-20 12:26:40 +04:00
|
|
|
painter->drawPixmap(QPoint(iconRect.left()+15,iconRect.top()),icon.pixmap(iconsize.width(),iconsize.height()));
|
2011-10-12 18:58:54 +04:00
|
|
|
|
2011-10-13 18:41:24 +04:00
|
|
|
painter->drawPixmap(QPoint(option.rect.right() - 4 - 48, option.rect.top() + 8 ), statusIcon.pixmap( 48,48));
|
|
|
|
|
2011-10-12 18:58:54 +04:00
|
|
|
painter->setFont(font);
|
|
|
|
painter->drawText(headerRect, aliasText);
|
|
|
|
|
2011-10-13 18:41:24 +04:00
|
|
|
painter->setFont(subFont);
|
2011-10-12 18:58:54 +04:00
|
|
|
painter->drawText(subheaderRect.left(),subheaderRect.top()+17, pathText);
|
2011-12-26 00:55:29 +04:00
|
|
|
painter->drawText(lastSyncRect, tr("Last Sync: %1").arg( statusText ));
|
|
|
|
painter->drawText(statusRect, tr("Sync Status: %1").arg( syncStatus ));
|
2011-10-12 18:58:54 +04:00
|
|
|
painter->restore();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2012-03-08 16:40:55 +04:00
|
|
|
|
|
|
|
bool FolderViewDelegate::editorEvent ( QEvent * event, QAbstractItemModel * model, const QStyleOptionViewItem & option, const QModelIndex & index )
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2011-10-12 18:58:54 +04:00
|
|
|
// ====================================================================================
|
2011-09-26 15:12:00 +04:00
|
|
|
|
2012-02-20 19:45:27 +04:00
|
|
|
StatusDialog::StatusDialog( Theme *theme, QWidget *parent) :
|
|
|
|
QDialog(parent),
|
2012-03-14 12:52:18 +04:00
|
|
|
_theme( theme ),
|
|
|
|
_ownCloudInfo(0)
|
2011-09-26 15:12:00 +04:00
|
|
|
{
|
2011-10-12 18:58:54 +04:00
|
|
|
setupUi( this );
|
2012-02-21 13:48:18 +04:00
|
|
|
setWindowTitle( _theme->appName() + QString (" %1" ).arg( _theme->version() ) );
|
2011-10-12 18:58:54 +04:00
|
|
|
|
2012-03-08 16:40:55 +04:00
|
|
|
_model = new FolderStatusModel();
|
2011-10-12 18:58:54 +04:00
|
|
|
FolderViewDelegate *delegate = new FolderViewDelegate();
|
2011-09-26 23:46:26 +04:00
|
|
|
|
2011-10-12 18:58:54 +04:00
|
|
|
_folderList->setItemDelegate( delegate );
|
|
|
|
_folderList->setModel( _model );
|
2011-10-20 12:26:40 +04:00
|
|
|
_folderList->setMinimumWidth( 300 );
|
2011-10-12 18:58:54 +04:00
|
|
|
|
2012-03-08 15:08:53 +04:00
|
|
|
connect( _folderList,SIGNAL(doubleClicked(QModelIndex)),SLOT(slotDoubleClicked(QModelIndex)));
|
|
|
|
|
2011-10-20 12:26:40 +04:00
|
|
|
connect(_ButtonClose, SIGNAL(clicked()), this, SLOT(accept()));
|
2011-10-12 18:58:54 +04:00
|
|
|
connect(_ButtonRemove, SIGNAL(clicked()), this, SLOT(slotRemoveFolder()));
|
2012-02-21 15:40:46 +04:00
|
|
|
#ifdef HAVE_FETCH_AND_PUSH
|
2011-10-20 12:26:40 +04:00
|
|
|
connect(_ButtonFetch, SIGNAL(clicked()), this, SLOT(slotFetchFolder()));
|
2012-02-21 15:40:46 +04:00
|
|
|
connect(_ButtonPush, SIGNAL(clicked()), this, SLOT(slotPushFolder()));
|
|
|
|
#else
|
|
|
|
_ButtonFetch->setVisible( false );
|
|
|
|
_ButtonPush->setVisible( false );
|
|
|
|
#endif
|
2011-10-20 13:48:41 +04:00
|
|
|
connect(_ButtonOpenOC, SIGNAL(clicked()), this, SLOT(slotOpenOC()));
|
2011-12-12 20:47:30 +04:00
|
|
|
connect(_ButtonEnable, SIGNAL(clicked()), this, SLOT(slotEnableFolder()));
|
2012-02-21 15:40:46 +04:00
|
|
|
connect(_ButtonInfo, SIGNAL(clicked()), this, SLOT(slotInfoFolder()));
|
2012-02-21 16:26:39 +04:00
|
|
|
connect(_ButtonAdd, SIGNAL(clicked()), this, SLOT(slotAddSync()));
|
2011-10-20 12:26:40 +04:00
|
|
|
|
2011-10-20 13:48:41 +04:00
|
|
|
_ButtonOpenOC->setEnabled(false);
|
2011-10-20 12:26:40 +04:00
|
|
|
_ButtonRemove->setEnabled(false);
|
|
|
|
_ButtonFetch->setEnabled(false);
|
2011-12-05 15:01:39 +04:00
|
|
|
_ButtonPush->setEnabled(false);
|
2011-12-12 20:47:30 +04:00
|
|
|
_ButtonEnable->setEnabled(false);
|
2012-01-24 01:10:01 +04:00
|
|
|
_ButtonInfo->setEnabled(false);
|
2012-02-21 16:26:39 +04:00
|
|
|
_ButtonAdd->setEnabled(true);
|
2011-10-20 12:26:40 +04:00
|
|
|
|
|
|
|
connect(_folderList, SIGNAL(activated(QModelIndex)), SLOT(slotFolderActivated(QModelIndex)));
|
|
|
|
}
|
|
|
|
|
|
|
|
void StatusDialog::slotFolderActivated( const QModelIndex& indx )
|
|
|
|
{
|
|
|
|
bool state = indx.isValid();
|
|
|
|
|
|
|
|
_ButtonRemove->setEnabled( state );
|
|
|
|
_ButtonFetch->setEnabled( state );
|
2011-12-05 15:01:39 +04:00
|
|
|
_ButtonPush->setEnabled( state );
|
2011-12-12 20:47:30 +04:00
|
|
|
_ButtonEnable->setEnabled( state );
|
2012-01-24 01:10:01 +04:00
|
|
|
_ButtonInfo->setEnabled( state );
|
2011-12-12 20:47:30 +04:00
|
|
|
|
|
|
|
if ( state ) {
|
|
|
|
bool folderEnabled = _model->data( indx, FolderViewDelegate::FolderSyncEnabled).toBool();
|
|
|
|
qDebug() << "folder is sync enabled: " << folderEnabled;
|
|
|
|
if ( folderEnabled ) {
|
|
|
|
_ButtonEnable->setText( tr( "disable" ) );
|
|
|
|
} else {
|
|
|
|
_ButtonEnable->setText( tr( "enable" ) );
|
|
|
|
}
|
|
|
|
}
|
2011-09-26 23:46:26 +04:00
|
|
|
}
|
|
|
|
|
2012-03-08 15:08:53 +04:00
|
|
|
void StatusDialog::slotDoubleClicked( const QModelIndex& indx )
|
|
|
|
{
|
|
|
|
if( ! indx.isValid() ) return;
|
2012-03-13 18:39:04 +04:00
|
|
|
QString alias = _model->data( indx, FolderViewDelegate::FolderAliasRole ).toString();
|
2012-03-08 15:08:53 +04:00
|
|
|
|
|
|
|
emit openFolderAlias( alias );
|
|
|
|
}
|
|
|
|
|
2011-10-12 18:58:54 +04:00
|
|
|
void StatusDialog::setFolderList( Folder::Map folders )
|
2011-09-26 23:46:26 +04:00
|
|
|
{
|
2012-03-13 18:39:04 +04:00
|
|
|
_model->clear();
|
|
|
|
foreach( Folder *f, folders ) {
|
|
|
|
qDebug() << "Folder: " << f;
|
|
|
|
slotAddFolder( f );
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void StatusDialog::slotAddFolder( Folder *folder )
|
|
|
|
{
|
|
|
|
if( ! folder || folder->alias().isEmpty() ) return;
|
2011-10-12 18:58:54 +04:00
|
|
|
|
|
|
|
QStandardItem *item = new QStandardItem();
|
2012-03-13 18:39:04 +04:00
|
|
|
folderToModelItem( item, folder );
|
|
|
|
_model->appendRow( item );
|
|
|
|
}
|
|
|
|
|
|
|
|
void StatusDialog::slotUpdateFolderState( Folder *folder )
|
|
|
|
{
|
|
|
|
QStandardItem *item = 0;
|
|
|
|
int row = 0;
|
|
|
|
|
|
|
|
if( ! folder ) return;
|
2012-02-20 19:45:27 +04:00
|
|
|
|
2012-03-13 18:39:04 +04:00
|
|
|
item = _model->item( row );
|
|
|
|
|
|
|
|
while( item ) {
|
|
|
|
if( item->data( FolderViewDelegate::FolderAliasRole ) == folder->alias() ) {
|
|
|
|
// its the item to update!
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
item = _model->item( ++row );
|
|
|
|
}
|
|
|
|
if( item ) {
|
|
|
|
folderToModelItem( item, folder );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void StatusDialog::folderToModelItem( QStandardItem *item, Folder *f )
|
|
|
|
{
|
2012-02-20 19:45:27 +04:00
|
|
|
QIcon icon = _theme->folderIcon( f->backend(), 48 );
|
|
|
|
item->setData( icon, FolderViewDelegate::FolderIconRole );
|
|
|
|
item->setData( f->path(), FolderViewDelegate::FolderPathRole );
|
2012-03-13 18:39:04 +04:00
|
|
|
item->setData( f->alias(), FolderViewDelegate::FolderAliasRole );
|
2011-12-12 20:47:30 +04:00
|
|
|
item->setData( f->syncEnabled(), FolderViewDelegate::FolderSyncEnabled );
|
2012-03-03 13:51:06 +04:00
|
|
|
qDebug() << "***** Folder is SyncEnabled: " << f->syncEnabled();
|
2011-10-13 18:41:24 +04:00
|
|
|
|
2012-02-20 19:45:27 +04:00
|
|
|
SyncResult res = f->syncResult();
|
|
|
|
SyncResult::Status status = res.status();
|
|
|
|
|
|
|
|
item->setData( _theme->syncStateIcon( status, 64 ), FolderViewDelegate::FolderStatusIcon );
|
|
|
|
item->setData( _theme->statusHeaderText( status ), FolderViewDelegate::FolderStatus );
|
|
|
|
item->setData( res.errorString(), FolderViewDelegate::FolderErrorMsg );
|
2011-09-26 23:46:26 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void StatusDialog::slotRemoveFolder()
|
|
|
|
{
|
2012-03-16 13:39:20 +04:00
|
|
|
QModelIndex selected = _folderList->selectionModel()->currentIndex();
|
|
|
|
if( selected.isValid() ) {
|
|
|
|
QString alias = _model->data( selected, FolderViewDelegate::FolderAliasRole ).toString();
|
|
|
|
qDebug() << "Remove Folder alias " << alias;
|
|
|
|
if( !alias.isEmpty() ) {
|
|
|
|
// remove from file system through folder man
|
|
|
|
emit(removeFolderAlias( alias ));
|
|
|
|
_model->removeRow( selected.row() );
|
|
|
|
}
|
2011-10-13 15:55:52 +04:00
|
|
|
}
|
2011-09-26 15:12:00 +04:00
|
|
|
}
|
2011-09-26 17:00:12 +04:00
|
|
|
|
2011-10-18 12:22:24 +04:00
|
|
|
void StatusDialog::slotFetchFolder()
|
|
|
|
{
|
|
|
|
QModelIndex selected = _folderList->selectionModel()->currentIndex();
|
|
|
|
if( selected.isValid() ) {
|
2012-03-13 18:39:04 +04:00
|
|
|
QString alias = _model->data( selected, FolderViewDelegate::FolderAliasRole ).toString();
|
2011-10-18 12:22:24 +04:00
|
|
|
qDebug() << "Fetch Folder alias " << alias;
|
|
|
|
if( !alias.isEmpty() ) {
|
|
|
|
emit(fetchFolderAlias( alias ));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-05 15:01:39 +04:00
|
|
|
void StatusDialog::slotPushFolder()
|
|
|
|
{
|
|
|
|
QModelIndex selected = _folderList->selectionModel()->currentIndex();
|
|
|
|
if( selected.isValid() ) {
|
2012-03-13 18:39:04 +04:00
|
|
|
QString alias = _model->data( selected, FolderViewDelegate::FolderAliasRole ).toString();
|
2011-12-05 15:01:39 +04:00
|
|
|
qDebug() << "Push Folder alias " << alias;
|
|
|
|
if( !alias.isEmpty() ) {
|
|
|
|
emit(pushFolderAlias( alias ));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-12 20:47:30 +04:00
|
|
|
void StatusDialog::slotEnableFolder()
|
|
|
|
{
|
|
|
|
QModelIndex selected = _folderList->selectionModel()->currentIndex();
|
|
|
|
if( selected.isValid() ) {
|
2012-03-13 18:39:04 +04:00
|
|
|
QString alias = _model->data( selected, FolderViewDelegate::FolderAliasRole ).toString();
|
2011-12-12 20:47:30 +04:00
|
|
|
bool folderEnabled = _model->data( selected, FolderViewDelegate::FolderSyncEnabled).toBool();
|
|
|
|
qDebug() << "Toggle enabled/disabled Folder alias " << alias << " - current state: " << folderEnabled;
|
|
|
|
if( !alias.isEmpty() ) {
|
|
|
|
emit(enableFolderAlias( alias, !folderEnabled ));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-01-24 01:10:01 +04:00
|
|
|
void StatusDialog::slotInfoFolder()
|
|
|
|
{
|
|
|
|
QModelIndex selected = _folderList->selectionModel()->currentIndex();
|
|
|
|
if( selected.isValid() ) {
|
2012-03-13 18:39:04 +04:00
|
|
|
QString alias = _model->data( selected, FolderViewDelegate::FolderAliasRole ).toString();
|
2012-01-24 01:10:01 +04:00
|
|
|
qDebug() << "Info Folder alias " << alias;
|
|
|
|
if( !alias.isEmpty() ) {
|
|
|
|
emit(infoFolderAlias( alias ));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-02-21 16:26:39 +04:00
|
|
|
void StatusDialog::slotAddSync()
|
|
|
|
{
|
|
|
|
qDebug() << "Add a sync requested.";
|
|
|
|
emit addASync();
|
|
|
|
}
|
|
|
|
|
2012-03-14 12:52:18 +04:00
|
|
|
void StatusDialog::slotCheckConnection()
|
|
|
|
{
|
|
|
|
_ownCloudInfo = new ownCloudInfo();
|
|
|
|
_ownCloudInfo->checkInstallation();
|
|
|
|
connect(_ownCloudInfo, SIGNAL(ownCloudInfoFound( const QString&, const QString& )),
|
|
|
|
SLOT(slotOCInfo( const QString&, const QString& )));
|
|
|
|
connect(_ownCloudInfo, SIGNAL(noOwncloudFound(QNetworkReply::NetworkError)),
|
|
|
|
SLOT(slotOCInfoFail()));
|
|
|
|
}
|
|
|
|
|
2012-02-21 15:40:46 +04:00
|
|
|
void StatusDialog::slotOCInfo( const QString& url, const QString& version )
|
2011-10-20 13:48:41 +04:00
|
|
|
{
|
2012-02-21 15:40:46 +04:00
|
|
|
_OCUrl = url;
|
|
|
|
/* enable the open button */
|
|
|
|
_ocUrlLabel->setText( tr("Connected to %1, ownCloud %2").arg(url).arg(version) );
|
2011-10-20 13:48:41 +04:00
|
|
|
_ButtonOpenOC->setEnabled( true );
|
2012-03-14 12:52:18 +04:00
|
|
|
_ButtonAdd->setEnabled(true);
|
|
|
|
_ownCloudInfo->deleteLater();
|
2011-10-20 13:48:41 +04:00
|
|
|
}
|
|
|
|
|
2012-02-21 15:40:46 +04:00
|
|
|
void StatusDialog::slotOCInfoFail()
|
|
|
|
{
|
|
|
|
_ocUrlLabel->setText( tr("Failed to connect to ownCloud. Please check configuration!") );
|
|
|
|
_ButtonOpenOC->setEnabled(false);
|
2012-02-21 16:26:39 +04:00
|
|
|
_ButtonAdd->setEnabled( false);
|
2012-03-14 12:52:18 +04:00
|
|
|
_ownCloudInfo->deleteLater();
|
2012-02-21 15:40:46 +04:00
|
|
|
}
|
|
|
|
|
2011-10-20 13:48:41 +04:00
|
|
|
void StatusDialog::slotOpenOC()
|
|
|
|
{
|
|
|
|
if( _OCUrl.isValid() )
|
|
|
|
QDesktopServices::openUrl( _OCUrl );
|
|
|
|
}
|
|
|
|
|
2012-03-14 12:52:18 +04:00
|
|
|
/*
|
|
|
|
* in the show event, start a connection check to the ownCloud.
|
|
|
|
*/
|
|
|
|
void StatusDialog::showEvent ( QShowEvent *event )
|
|
|
|
{
|
|
|
|
slotCheckConnection();
|
|
|
|
QDialog::showEvent( event );
|
|
|
|
}
|
|
|
|
|
2011-09-26 17:00:12 +04:00
|
|
|
}
|
|
|
|
|