From 8fbc0e7c46d0fb23835ea35af1eee017d1f7a59e Mon Sep 17 00:00:00 2001 From: Daniel Molkentin Date: Sat, 20 Oct 2012 13:58:27 +0200 Subject: [PATCH] Show wizard with intro when starting without account The message box was complicated and not even correct on some OSes. The intro page is omitted if the wizard gets called via the "Configure" menu item. --- src/mirall/application.cpp | 12 +--- src/mirall/owncloudsetuppage.ui | 101 ++++++++++++----------------- src/mirall/owncloudsetupwizard.cpp | 8 ++- src/mirall/owncloudsetupwizard.h | 5 +- src/mirall/owncloudwizard.cpp | 22 +++++++ src/mirall/owncloudwizard.h | 15 +++++ 6 files changed, 92 insertions(+), 71 deletions(-) diff --git a/src/mirall/application.cpp b/src/mirall/application.cpp index 885c2b8d8c..b7d59bc535 100644 --- a/src/mirall/application.cpp +++ b/src/mirall/application.cpp @@ -198,13 +198,7 @@ void Application::slotStartFolderSetup( int result ) ownCloudInfo::instance()->checkInstallation(); } else { - QMessageBox::warning(0, tr("No %1 Configuration").arg(_theme->appName()), - tr("

No server connection has been configured for this %1 client.

" - "

Please right click on the %1 system tray icon and select Configure " - "to connect this client to an %1 server.

").arg(_theme->appName())); - // It was evaluated to open the config dialog from here directly but decided - // against because the user does not know why. The popup gives a better user - // guidance, even if its a click more. + _owncloudSetupWizard->startWizard(true); // with intro } } else { qDebug() << "Setup Wizard was canceled. No reparsing of config."; @@ -623,7 +617,7 @@ void Application::slotOpenStatus() if( !cfgFile.exists() ) { qDebug() << "No configured folders yet, start the Owncloud integration dialog."; - _owncloudSetupWizard->startWizard(); + _owncloudSetupWizard->startWizard(true); // with intro } else { qDebug() << "#============# Status dialog starting #=============#"; raiseWidget = _statusDialog; @@ -795,7 +789,7 @@ void Application::slotEnableFolder(const QString& alias, const bool enable) void Application::slotConfigure() { _folderMan->disableFoldersWithRestore(); - _owncloudSetupWizard->startWizard(); + _owncloudSetupWizard->startWizard(false); _folderMan->restoreEnabledFolders(); } diff --git a/src/mirall/owncloudsetuppage.ui b/src/mirall/owncloudsetuppage.ui index b00ee793fc..4074de0a3a 100644 --- a/src/mirall/owncloudsetuppage.ui +++ b/src/mirall/owncloudsetuppage.ui @@ -7,33 +7,14 @@ 0 0 480 - 271 + 278 Form - - - - Qt::Horizontal - - - - - 14 - 50 - false - - - - Create the ownCloud Connection - - - - - + Server &address: @@ -43,25 +24,20 @@ - - - - - - https:// - - - - - - - Enter the url of the ownCloud you want to connect to (without http or https). - - - - + + + + + 0 + 0 + + + + TextLabel + + - + @@ -156,7 +132,32 @@ - + + + + + + https:// + + + + + + + Enter the url of the ownCloud you want to connect to (without http or https). + + + + + + + + + TextLabel + + + + Qt::Vertical @@ -169,26 +170,6 @@ - - - - - 0 - 0 - - - - TextLabel - - - - - - - TextLabel - - - diff --git a/src/mirall/owncloudsetupwizard.cpp b/src/mirall/owncloudsetupwizard.cpp index 2f8ef5632c..ca2aed5431 100644 --- a/src/mirall/owncloudsetupwizard.cpp +++ b/src/mirall/owncloudsetupwizard.cpp @@ -323,7 +323,7 @@ void OwncloudSetupWizard::slotProcessFinished( int res, QProcess::ExitStatus ) } } -void OwncloudSetupWizard::startWizard() +void OwncloudSetupWizard::startWizard(bool intro) { // create the ocInfo object connect(ownCloudInfo::instance(),SIGNAL(ownCloudInfoFound(QString,QString,QString,QString)),SLOT(slotOwnCloudFound(QString,QString,QString,QString))); @@ -336,6 +336,12 @@ void OwncloudSetupWizard::startWizard() if( !url.isEmpty() ) { _ocWizard->setOCUrl( url ); } +#ifdef OWNCLOUD_CLIENT + if (intro) + _ocWizard->setStartId(OwncloudWizard::Page_oCWelcome); + else + _ocWizard->setStartId(OwncloudWizard::Page_oCSetup); +#endif _ocWizard->restart(); _ocWizard->show(); } diff --git a/src/mirall/owncloudsetupwizard.h b/src/mirall/owncloudsetupwizard.h index bf7f8a6765..b275068829 100644 --- a/src/mirall/owncloudsetupwizard.h +++ b/src/mirall/owncloudsetupwizard.h @@ -38,7 +38,10 @@ public: ~OwncloudSetupWizard(); - void startWizard( ); + /** + * @intro wether or not to show the intro wizard page + */ + void startWizard(bool intro = false); void installServer(); diff --git a/src/mirall/owncloudwizard.cpp b/src/mirall/owncloudwizard.cpp index 34724e6994..4da487bed3 100644 --- a/src/mirall/owncloudwizard.cpp +++ b/src/mirall/owncloudwizard.cpp @@ -55,10 +55,31 @@ void setupCustomMedia( QVariant variant, QLabel *label ) // ====================================================================== +OwncloudWelcomePage::OwncloudWelcomePage() +{ + setTitle(tr("Welcome to %1").arg(Theme::instance()->appName())); + setSubTitle(tr("Set up your server connection")); + + QVBoxLayout *lay = new QVBoxLayout(this); + QLabel *content = new QLabel; + lay->addWidget(content, 100, Qt::AlignTop); + content->setAlignment(Qt::AlignTop); + content->setTextFormat(Qt::RichText); + content->setWordWrap(true); + content->setText(tr("

In order to connect to your %1 server, you need to provide the server address " + "as well as your credentials.

This wizard will guide you through the process.

" + "

If you have not received this information, please contact your %1 hosting provider.

") + .arg(Theme::instance()->appName())); +} + + OwncloudSetupPage::OwncloudSetupPage() { _ui.setupUi(this); + setTitle(tr("Create the %1 Connection").arg(Theme::instance()->appName())); + setSubTitle(tr("Enter Server Name and Credentials")); + connect(_ui.leUrl, SIGNAL(textChanged(QString)), SLOT(handleNewOcUrl(QString))); registerField( QLatin1String("OCUrl"), _ui.leUrl ); @@ -471,6 +492,7 @@ OwncloudWizard::OwncloudWizard(QWidget *parent) : QWizard(parent) { #ifdef OWNCLOUD_CLIENT + setPage(Page_oCWelcome, new OwncloudWelcomePage() ); setPage(Page_oCSetup, new OwncloudSetupPage() ); #else setPage(Page_SelectType, new OwncloudWizardSelectTypePage() ); diff --git a/src/mirall/owncloudwizard.h b/src/mirall/owncloudwizard.h index 35bc7ba1db..acc34676b7 100644 --- a/src/mirall/owncloudwizard.h +++ b/src/mirall/owncloudwizard.h @@ -57,6 +57,7 @@ class OwncloudWizard: public QWizard public: enum { + Page_oCWelcome, Page_oCSetup, Page_SelectType, Page_Create_OC, @@ -93,6 +94,20 @@ private: QString _oCUrl; }; + +/** + * page for first launch only + */ +class OwncloudWelcomePage: public QWizardPage +{ + Q_OBJECT +public: + OwncloudWelcomePage(); + + virtual int nextId() const { return OwncloudWizard::Page_oCSetup; } +}; + + /** * page to ask for the type of Owncloud to connect to */