Added owncloud credentials page

This commit is contained in:
Klaas Freitag 2011-09-30 12:51:56 +02:00
parent 3f860709bc
commit 7452f1956e
5 changed files with 195 additions and 6 deletions

View file

@ -13,6 +13,7 @@ mirall/owncloudwizardselecttypepage.ui
mirall/createanowncloudpage.ui
mirall/owncloudftpaccesspage.ui
mirall/owncloudwizardresultpage.ui
mirall/owncloudcredentialspage.ui
)
qt4_wrap_ui(mirall_UI_SRCS ${mirall_UI})

View file

@ -0,0 +1,135 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>OwncloudCredentialsPage</class>
<widget class="QWidget" name="OwncloudCredentialsPage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>587</width>
<height>374</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_12">
<item>
<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>Owncloud Credentials:</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_17">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Provide Owncloud Credentials</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="label_4">
<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;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:11pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; color:#585858;&quot;&gt;Provide the credentials to your ownCloud Instance. If you do not have credentials yet, quickly open the ownCloud link and finish the setup.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="textFormat">
<enum>Qt::AutoText</enum>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Owncloud-User:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="OCUserEdit">
<property name="text">
<string/>
</property>
<property name="placeholderText">
<string>john</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Password:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="OCPasswdEdit">
<property name="text">
<string/>
</property>
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
<property name="placeholderText">
<string>secret</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item row="2" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>530</width>
<height>194</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View file

@ -180,6 +180,9 @@ void OwncloudSetup::writeOwncloudConfig()
qDebug() << "*** writing mirall config to " << mirallConfigFile();
QSettings settings( mirallConfigFile(), QSettings::IniFormat);
settings.setValue("ownCloud/url", _ocWizard->field("OCUrl").toString() );
settings.setValue("ownCloud/user", _ocWizard->field("OCUser").toString() );
settings.setValue("ownCloud/password", _ocWizard->field("OCPasswd").toString() );
settings.sync();
}

View file

@ -52,7 +52,7 @@ void OwncloudWizardSelectTypePage::initializePage()
int OwncloudWizardSelectTypePage::nextId() const
{
if( _ui.connectMyOCRadioBtn->isChecked() ) {
return OwncloudWizard::Page_Install;
return OwncloudWizard::Page_OC_Credentials;
}
return OwncloudWizard::Page_Create_OC;
}
@ -79,6 +79,37 @@ void OwncloudWizardSelectTypePage::setOCUrl( const QString& url )
// ======================================================================
OwncloudCredentialsPage::OwncloudCredentialsPage()
{
_ui.setupUi(this);
registerField( "OCUser", _ui.OCUserEdit );
registerField( "OCPasswd", _ui.OCPasswdEdit );
}
OwncloudCredentialsPage::~OwncloudCredentialsPage()
{
}
bool OwncloudCredentialsPage::isComplete() const
{
}
void OwncloudCredentialsPage::initializePage()
{
QString user = getenv( "USER" );
_ui.OCUserEdit->setText( user );
}
int OwncloudCredentialsPage::nextId() const
{
return OwncloudWizard::Page_Install;
}
// ======================================================================
OwncloudFTPAccessPage::OwncloudFTPAccessPage()
{
_ui.setupUi(this);
@ -140,7 +171,7 @@ void CreateAnOwncloudPage::initializePage()
int CreateAnOwncloudPage::nextId() const
{
if( _ui.createLocalRadioBtn->isChecked() ) {
return OwncloudWizard::Page_Install;
return OwncloudWizard::Page_OC_Credentials;
}
return OwncloudWizard::Page_FTP;
@ -203,10 +234,11 @@ void OwncloudWizardResultPage::appendResultText( const QString& msg )
OwncloudWizard::OwncloudWizard(QWidget *parent)
: QWizard(parent)
{
setPage(Page_SelectType, new OwncloudWizardSelectTypePage() );
setPage(Page_Create_OC, new CreateAnOwncloudPage() );
setPage(Page_FTP, new OwncloudFTPAccessPage() );
setPage(Page_Install, new OwncloudWizardResultPage() );
setPage(Page_SelectType, new OwncloudWizardSelectTypePage() );
setPage(Page_Create_OC, new CreateAnOwncloudPage() );
setPage(Page_FTP, new OwncloudFTPAccessPage() );
setPage(Page_OC_Credentials, new OwncloudCredentialsPage() );
setPage(Page_Install, new OwncloudWizardResultPage() );
setWizardStyle( QWizard::ClassicStyle );

View file

@ -21,6 +21,7 @@
#include "ui_createanowncloudpage.h"
#include "ui_owncloudftpaccesspage.h"
#include "ui_owncloudwizardresultpage.h"
#include "ui_owncloudcredentialspage.h"
namespace Mirall {
@ -62,6 +63,22 @@ private:
};
class OwncloudCredentialsPage: public QWizardPage
{
Q_OBJECT
public:
OwncloudCredentialsPage();
~OwncloudCredentialsPage();
virtual bool isComplete() const;
virtual void initializePage();
virtual int nextId() const;
private:
Ui_OwncloudCredentialsPage _ui;
};
/**
* page to ask for the ftp credentials etc. for ftp install
*/
@ -115,6 +132,7 @@ public:
enum {
Page_SelectType,
Page_Create_OC,
Page_OC_Credentials,
Page_FTP,
Page_Install
};