Hide some buttons in status dialog which are currently not needed,

show ownCloud info on status dialog
This commit is contained in:
Klaas Freitag 2012-02-21 12:40:46 +01:00
Родитель da482e742b
Коммит 267f444dd1
4 изменённых файлов: 125 добавлений и 88 удалений

Просмотреть файл

@ -191,7 +191,6 @@ void Application::slotTrayClicked( QSystemTrayIcon::ActivationReason reason )
qDebug() << "No configured folders yet, start the Owncloud integration dialog.";
_owncloudSetupWizard->startWizard();
} else {
_statusDialog->setOCUrl( QUrl( cfgFile.ownCloudUrl()) );
_statusDialog->setFolderList( _folderMan->map() );
_statusDialog->show();
}

Просмотреть файл

@ -18,6 +18,7 @@
#include "mirall/statusdialog.h"
#include "mirall/folder.h"
#include "mirall/theme.h"
#include "mirall/owncloudinfo.h"
namespace Mirall {
FolderViewDelegate::FolderViewDelegate()
@ -125,11 +126,16 @@ StatusDialog::StatusDialog( Theme *theme, QWidget *parent) :
connect(_ButtonClose, SIGNAL(clicked()), this, SLOT(accept()));
connect(_ButtonRemove, SIGNAL(clicked()), this, SLOT(slotRemoveFolder()));
#ifdef HAVE_FETCH_AND_PUSH
connect(_ButtonFetch, SIGNAL(clicked()), this, SLOT(slotFetchFolder()));
connect(_ButtonPush, SIGNAL(clicked()), this, SLOT(slotPushFolder()));
connect(_ButtonPush, SIGNAL(clicked()), this, SLOT(slotPushFolder()));
#else
_ButtonFetch->setVisible( false );
_ButtonPush->setVisible( false );
#endif
connect(_ButtonOpenOC, SIGNAL(clicked()), this, SLOT(slotOpenOC()));
connect(_ButtonEnable, SIGNAL(clicked()), this, SLOT(slotEnableFolder()));
connect(_ButtonInfo, SIGNAL(clicked()), this, SLOT(slotInfoFolder()));
connect(_ButtonInfo, SIGNAL(clicked()), this, SLOT(slotInfoFolder()));
_ButtonOpenOC->setEnabled(false);
_ButtonRemove->setEnabled(false);
@ -139,6 +145,13 @@ StatusDialog::StatusDialog( Theme *theme, QWidget *parent) :
_ButtonInfo->setEnabled(false);
connect(_folderList, SIGNAL(activated(QModelIndex)), SLOT(slotFolderActivated(QModelIndex)));
_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()));
}
void StatusDialog::slotFolderActivated( const QModelIndex& indx )
@ -251,13 +264,20 @@ void StatusDialog::slotInfoFolder()
}
}
void StatusDialog::setOCUrl( const QUrl& url )
void StatusDialog::slotOCInfo( const QString& url, const QString& version )
{
_OCUrl = url;
if( url.isValid() )
_OCUrl = url;
/* enable the open button */
_ocUrlLabel->setText( tr("Connected to %1, ownCloud %2").arg(url).arg(version) );
_ButtonOpenOC->setEnabled( true );
}
void StatusDialog::slotOCInfoFail()
{
_ocUrlLabel->setText( tr("Failed to connect to ownCloud. Please check configuration!") );
_ButtonOpenOC->setEnabled(false);
}
void StatusDialog::slotOpenOC()
{
if( _OCUrl.isValid() )

Просмотреть файл

@ -26,6 +26,7 @@
namespace Mirall {
class Theme;
class ownCloudInfo;
class FolderViewDelegate : public QStyledItemDelegate
{
@ -52,7 +53,6 @@ class StatusDialog : public QDialog, public Ui::statusDialog
public:
explicit StatusDialog( Theme *theme, QWidget *parent = 0);
void setFolderList( Folder::Map );
void setOCUrl( const QUrl& );
signals:
void removeFolderAlias( const QString& );
@ -70,10 +70,15 @@ public slots:
void slotEnableFolder();
void slotInfoFolder();
protected slots:
void slotOCInfoFail();
void slotOCInfo( const QString&, const QString& );
private:
QStandardItemModel *_model;
QUrl _OCUrl;
Theme *_theme;
ownCloudInfo *_ownCloudInfo;
};
};

Просмотреть файл

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>407</width>
<height>269</height>
<width>496</width>
<height>327</height>
</rect>
</property>
<property name="windowTitle">
@ -26,94 +26,107 @@
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout">
<item row="1" column="0" rowspan="7">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QListView" name="_folderList"/>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QPushButton" name="_ButtonRemove">
<property name="text">
<string>remove...</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="_ButtonFetch">
<property name="text">
<string>fetch...</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="_ButtonPush">
<property name="text">
<string>push...</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="_ButtonEnable">
<property name="text">
<string>enable</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="_ButtonInfo">
<property name="text">
<string>info...</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="_ButtonOpenOC">
<property name="text">
<string>open...</string>
</property>
<property name="icon">
<iconset resource="../../mirall.qrc">
<normaloff>:/mirall/resources/mirall-128.png</normaloff>:/mirall/resources/mirall-128.png</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
</widget>
</item>
</layout>
<widget class="QListView" name="_folderList"/>
</item>
</layout>
</item>
<item row="2" column="0" colspan="2">
<item row="1" column="1">
<widget class="QPushButton" name="_ButtonAdd">
<property name="text">
<string>Add Sync...</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QPushButton" name="_ButtonRemove">
<property name="text">
<string>Remove...</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QPushButton" name="_ButtonFetch">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>fetch...</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QPushButton" name="_ButtonPush">
<property name="text">
<string>push...</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QPushButton" name="_ButtonEnable">
<property name="text">
<string>enable</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QPushButton" name="_ButtonInfo">
<property name="text">
<string>info...</string>
</property>
</widget>
</item>
<item row="7" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>56</height>
</size>
</property>
</spacer>
</item>
<item row="8" column="0" colspan="3">
<layout class="QHBoxLayout" name="horizontalLayout" stretch="5,0">
<item>
<widget class="QLabel" name="_ocUrlLabel">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="_ButtonOpenOC">
<property name="text">
<string>open...</string>
</property>
<property name="icon">
<iconset resource="../../mirall.qrc">
<normaloff>:/mirall/resources/mirall-128.png</normaloff>:/mirall/resources/mirall-128.png</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
<item row="9" column="0" colspan="3">
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="3" column="0">
<item row="10" column="0">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@ -126,7 +139,7 @@
</property>
</spacer>
</item>
<item row="3" column="1">
<item row="10" column="1">
<widget class="QPushButton" name="_ButtonClose">
<property name="text">
<string>Close</string>