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.
This commit is contained in:
Daniel Molkentin 2012-10-20 13:58:27 +02:00
parent d8728a56bc
commit 8fbc0e7c46
6 changed files with 92 additions and 71 deletions

View File

@ -198,13 +198,7 @@ void Application::slotStartFolderSetup( int result )
ownCloudInfo::instance()->checkInstallation();
} else {
QMessageBox::warning(0, tr("No %1 Configuration").arg(_theme->appName()),
tr("<p>No server connection has been configured for this %1 client.</p>"
"<p>Please right click on the %1 system tray icon and select <i>Configure</i> "
"to connect this client to an %1 server.</p>").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();
}

View File

@ -7,33 +7,14 @@
<x>0</x>
<y>0</y>
<width>480</width>
<height>271</height>
<height>278</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="0" colspan="2">
<widget class="QSplitter" name="splitter_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<widget class="QLabel" name="label_3">
<property name="font">
<font>
<pointsize>14</pointsize>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>Create the ownCloud Connection</string>
</property>
</widget>
</widget>
</item>
<item row="2" column="0">
<item row="1" column="0">
<widget class="QLabel" name="serverAddressLabel">
<property name="text">
<string>Server &amp;address:</string>
@ -43,25 +24,20 @@
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="protocolLabel">
<property name="text">
<string>https://</string>
</property>
</widget>
</item>
<item>
<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>
</layout>
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="topLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item row="4" column="0" colspan="2">
<item row="3" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
@ -156,7 +132,32 @@
</item>
</layout>
</item>
<item row="6" column="1">
<item row="2" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="protocolLabel">
<property name="text">
<string>https://</string>
</property>
</widget>
</item>
<item>
<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>
</layout>
</item>
<item row="4" column="0" colspan="2">
<widget class="QLabel" name="bottomLabel">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item row="5" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
@ -169,26 +170,6 @@
</property>
</spacer>
</item>
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="topLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item row="5" column="0" colspan="2">
<widget class="QLabel" name="bottomLabel">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>

View File

@ -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();
}

View File

@ -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();

View File

@ -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("<p>In order to connect to your %1 server, you need to provide the server address "
"as well as your credentials.</p><p>This wizard will guide you through the process.<p>"
"<p>If you have not received this information, please contact your %1 hosting provider.</p>")
.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() );

View File

@ -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
*/