From 66d70c083595812205ef5241f8a59ceb0e8a1dfe Mon Sep 17 00:00:00 2001 From: Klaas Freitag Date: Thu, 26 Jul 2012 11:01:43 +0300 Subject: [PATCH] More custom media for the connect dialog. --- src/mirall/mirallconfigfile.cpp | 2 + src/mirall/mirallconfigfile.h | 5 ++- src/mirall/owncloudsetuppage.ui | 17 ++++++-- src/mirall/owncloudwizard.cpp | 54 ++++++++++++++++---------- src/mirall/owncloudwizard.h | 6 ++- src/mirall/owncloudwizardresultpage.ui | 33 +++++++++------- 6 files changed, 78 insertions(+), 39 deletions(-) diff --git a/src/mirall/mirallconfigfile.cpp b/src/mirall/mirallconfigfile.cpp index cbbf6e4df..ba698b7ad 100644 --- a/src/mirall/mirallconfigfile.cpp +++ b/src/mirall/mirallconfigfile.cpp @@ -444,6 +444,8 @@ QVariant MirallConfigFile::customMedia( customMediaType type ) key = QLatin1String("oCSetupBottom"); } else if( type == oCSetupFixUrl ) { key = QLatin1String("oCSetupFixUrl"); + } else if( type == oCSetupResultTop ) { + key = QLatin1String("oCSetupResultTop"); } else { qDebug() << "Wrong media type."; } diff --git a/src/mirall/mirallconfigfile.h b/src/mirall/mirallconfigfile.h index c4a572c51..d0ca70075 100644 --- a/src/mirall/mirallconfigfile.h +++ b/src/mirall/mirallconfigfile.h @@ -28,10 +28,11 @@ public: MirallConfigFile( const QString& appendix = QString() ); enum customMediaType { - oCSetupTop, + oCSetupTop, // ownCloud connect page oCSetupSide, oCSetupBottom, - oCSetupFixUrl + oCSetupFixUrl, + oCSetupResultTop // ownCloud connect result page }; QString configPath() const; diff --git a/src/mirall/owncloudsetuppage.ui b/src/mirall/owncloudsetuppage.ui index 7f1b14fc0..a66fe3523 100644 --- a/src/mirall/owncloudsetuppage.ui +++ b/src/mirall/owncloudsetuppage.ui @@ -53,7 +53,11 @@ - + + + Enter the url of the ownCloud you want to connect to (without http or https). + + @@ -100,7 +104,11 @@ - + + + Enter the ownCloud username. + + @@ -129,6 +137,9 @@ + + Do not allow the local storage of the password. + &do not store Password on local machine. @@ -153,7 +164,7 @@ 344 - 19 + 1 diff --git a/src/mirall/owncloudwizard.cpp b/src/mirall/owncloudwizard.cpp index 4985c8521..f4bf551d9 100644 --- a/src/mirall/owncloudwizard.cpp +++ b/src/mirall/owncloudwizard.cpp @@ -30,6 +30,26 @@ namespace Mirall { +void setupCustomMedia( QVariant variant, QLabel *label ) +{ + if( ! label ) return; + + QPixmap pix = variant.value(); + 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(); - 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 ) { _ui.lePassword->setEnabled( state == Qt::Unchecked ); @@ -372,6 +372,8 @@ OwncloudWizardResultPage::OwncloudWizardResultPage() // no fields to register. _ui.resultTextEdit->setAcceptRichText(true); _ui.ocLinkLabel->setVisible( false ); + + setupCustomization(); } 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 ); +} + // ====================================================================== /** diff --git a/src/mirall/owncloudwizard.h b/src/mirall/owncloudwizard.h index 6a122fd55..272ef1ce8 100644 --- a/src/mirall/owncloudwizard.h +++ b/src/mirall/owncloudwizard.h @@ -46,7 +46,6 @@ protected slots: void slotPwdStoreChanged( int ); void slotSecureConChanged( int ); void setupCustomization(); - void setupCustomMedia( QVariant, QLabel* ); private: Ui_OwncloudSetupPage _ui; @@ -75,6 +74,8 @@ public: void setOCUrl( const QString& ); + void setupCustomMedia( QVariant, QLabel* ); + public slots: void appendToResultWidget( const QString& msg, LogType type = LogParagraph ); void slotCurrentPageChanged( int ); @@ -186,6 +187,9 @@ public slots: void appendResultText( const QString&, OwncloudWizard::LogType type = OwncloudWizard::LogParagraph ); void showOCUrlLabel( const QString&, bool ); +protected: + void setupCustomization(); + private: Ui_OwncloudWizardResultPage _ui; diff --git a/src/mirall/owncloudwizardresultpage.ui b/src/mirall/owncloudwizardresultpage.ui index 7704aeef6..64f77cdec 100644 --- a/src/mirall/owncloudwizardresultpage.ui +++ b/src/mirall/owncloudwizardresultpage.ui @@ -6,15 +6,29 @@ 0 0 - 595 - 371 + 526 + 357 Form - + + + + true + + + + + + + TextLabel + + + + @@ -45,7 +59,7 @@ - + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> @@ -65,15 +79,8 @@ p, li { white-space: pre-wrap; } - - - - true - - - - - + + TextLabel