More custom media for the connect dialog.

This commit is contained in:
Klaas Freitag 2012-07-26 11:01:43 +03:00
parent 0c89dd9555
commit 66d70c0835
6 changed files with 78 additions and 39 deletions

View file

@ -444,6 +444,8 @@ QVariant MirallConfigFile::customMedia( customMediaType type )
key = QLatin1String("oCSetupBottom"); key = QLatin1String("oCSetupBottom");
} else if( type == oCSetupFixUrl ) { } else if( type == oCSetupFixUrl ) {
key = QLatin1String("oCSetupFixUrl"); key = QLatin1String("oCSetupFixUrl");
} else if( type == oCSetupResultTop ) {
key = QLatin1String("oCSetupResultTop");
} else { } else {
qDebug() << "Wrong media type."; qDebug() << "Wrong media type.";
} }

View file

@ -28,10 +28,11 @@ public:
MirallConfigFile( const QString& appendix = QString() ); MirallConfigFile( const QString& appendix = QString() );
enum customMediaType { enum customMediaType {
oCSetupTop, oCSetupTop, // ownCloud connect page
oCSetupSide, oCSetupSide,
oCSetupBottom, oCSetupBottom,
oCSetupFixUrl oCSetupFixUrl,
oCSetupResultTop // ownCloud connect result page
}; };
QString configPath() const; QString configPath() const;

View file

@ -53,7 +53,11 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLineEdit" name="leUrl"/> <widget class="QLineEdit" name="leUrl">
<property name="toolTip">
<string>Enter the url of the ownCloud you want to connect to (without http or https).</string>
</property>
</widget>
</item> </item>
</layout> </layout>
</item> </item>
@ -100,7 +104,11 @@
</widget> </widget>
</item> </item>
<item row="0" column="1"> <item row="0" column="1">
<widget class="QLineEdit" name="leUsername"/> <widget class="QLineEdit" name="leUsername">
<property name="toolTip">
<string>Enter the ownCloud username.</string>
</property>
</widget>
</item> </item>
<item row="1" column="0"> <item row="1" column="0">
<widget class="QLabel" name="label_4"> <widget class="QLabel" name="label_4">
@ -129,6 +137,9 @@
</item> </item>
<item> <item>
<widget class="QCheckBox" name="cbNoPasswordStore"> <widget class="QCheckBox" name="cbNoPasswordStore">
<property name="toolTip">
<string>Do not allow the local storage of the password.</string>
</property>
<property name="text"> <property name="text">
<string>&amp;do not store Password on local machine.</string> <string>&amp;do not store Password on local machine.</string>
</property> </property>
@ -153,7 +164,7 @@
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
<width>344</width> <width>344</width>
<height>19</height> <height>1</height>
</size> </size>
</property> </property>
</spacer> </spacer>

View file

@ -30,6 +30,26 @@
namespace Mirall namespace Mirall
{ {
void setupCustomMedia( QVariant variant, QLabel *label )
{
if( ! label ) return;
QPixmap pix = variant.value<QPixmap>();
if( ! pix.isNull() ) {
label->setPixmap(pix);
label->setAlignment( Qt::AlignTop | Qt::AlignRight );
label->setVisible(true);
} else {
QString str = variant.toString();
if( !str.isEmpty() ) {
label->setText( str );
label->setTextFormat( Qt::RichText );
label->setVisible(true);
label->setOpenExternalLinks(true);
}
}
}
// ====================================================================== // ======================================================================
@ -108,26 +128,6 @@ void OwncloudSetupPage::setupCustomization()
} }
} }
void OwncloudSetupPage::setupCustomMedia( QVariant variant, QLabel *label )
{
if( ! label ) return;
QPixmap pix = variant.value<QPixmap>();
if( ! pix.isNull() ) {
label->setPixmap(pix);
label->setAlignment( Qt::AlignTop | Qt::AlignRight );
label->setVisible(true);
} else {
QString str = variant.toString();
if( !str.isEmpty() ) {
label->setText( str );
label->setTextFormat( Qt::RichText );
label->setVisible(true);
label->setOpenExternalLinks(true);
}
}
}
void OwncloudSetupPage::slotPwdStoreChanged( int state ) void OwncloudSetupPage::slotPwdStoreChanged( int state )
{ {
_ui.lePassword->setEnabled( state == Qt::Unchecked ); _ui.lePassword->setEnabled( state == Qt::Unchecked );
@ -372,6 +372,8 @@ OwncloudWizardResultPage::OwncloudWizardResultPage()
// no fields to register. // no fields to register.
_ui.resultTextEdit->setAcceptRichText(true); _ui.resultTextEdit->setAcceptRichText(true);
_ui.ocLinkLabel->setVisible( false ); _ui.ocLinkLabel->setVisible( false );
setupCustomization();
} }
OwncloudWizardResultPage::~OwncloudWizardResultPage() OwncloudWizardResultPage::~OwncloudWizardResultPage()
@ -415,6 +417,18 @@ void OwncloudWizardResultPage::showOCUrlLabel( const QString& url, bool show )
} }
} }
void OwncloudWizardResultPage::setupCustomization()
{
// set defaults for the customize labels.
_ui.topLabel->setText( QString() );
_ui.topLabel->hide();
MirallConfigFile cfg;
QVariant variant = cfg.customMedia( MirallConfigFile::oCSetupResultTop );
setupCustomMedia( variant, _ui.topLabel );
}
// ====================================================================== // ======================================================================
/** /**

View file

@ -46,7 +46,6 @@ protected slots:
void slotPwdStoreChanged( int ); void slotPwdStoreChanged( int );
void slotSecureConChanged( int ); void slotSecureConChanged( int );
void setupCustomization(); void setupCustomization();
void setupCustomMedia( QVariant, QLabel* );
private: private:
Ui_OwncloudSetupPage _ui; Ui_OwncloudSetupPage _ui;
@ -75,6 +74,8 @@ public:
void setOCUrl( const QString& ); void setOCUrl( const QString& );
void setupCustomMedia( QVariant, QLabel* );
public slots: public slots:
void appendToResultWidget( const QString& msg, LogType type = LogParagraph ); void appendToResultWidget( const QString& msg, LogType type = LogParagraph );
void slotCurrentPageChanged( int ); void slotCurrentPageChanged( int );
@ -186,6 +187,9 @@ public slots:
void appendResultText( const QString&, OwncloudWizard::LogType type = OwncloudWizard::LogParagraph ); void appendResultText( const QString&, OwncloudWizard::LogType type = OwncloudWizard::LogParagraph );
void showOCUrlLabel( const QString&, bool ); void showOCUrlLabel( const QString&, bool );
protected:
void setupCustomization();
private: private:
Ui_OwncloudWizardResultPage _ui; Ui_OwncloudWizardResultPage _ui;

View file

@ -6,15 +6,29 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>595</width> <width>526</width>
<height>371</height> <height>357</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Form</string> <string>Form</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="0" column="0"> <item row="3" column="0">
<widget class="QTextEdit" name="resultTextEdit">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="ocLinkLabel">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_12"> <layout class="QHBoxLayout" name="horizontalLayout_12">
<item> <item>
<widget class="QLabel" name="label_3"> <widget class="QLabel" name="label_3">
@ -45,7 +59,7 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="1" column="0"> <item row="2" column="0">
<widget class="QLabel" name="label_4"> <widget class="QLabel" name="label_4">
<property name="text"> <property name="text">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt; <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
@ -65,15 +79,8 @@ p, li { white-space: pre-wrap; }
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="0"> <item row="0" column="0">
<widget class="QTextEdit" name="resultTextEdit"> <widget class="QLabel" name="topLabel">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="ocLinkLabel">
<property name="text"> <property name="text">
<string>TextLabel</string> <string>TextLabel</string>
</property> </property>