Updated account editing/creation page to be more clear about the format of

the hostname.
This commit is contained in:
Juan Carlos Cornejo 2011-12-09 20:42:51 -05:00 committed by Klaas Freitag
parent d14150b910
commit 7bcbeb6578
3 changed files with 63 additions and 9 deletions

View file

@ -238,6 +238,11 @@ void SyncWindow::on_buttonSave_clicked()
QFileInfo info(mConfigDirectory+"/"+ui->lineName->text()+".db"); QFileInfo info(mConfigDirectory+"/"+ui->lineName->text()+".db");
bool okToEdit = true; bool okToEdit = true;
ui->buttonSave->setDisabled(true); ui->buttonSave->setDisabled(true);
QString host = ui->lineHost->text();
host.replace("http://","");
host.replace("https://","");
host.replace("webdav://","");
host.replace("webdavs://","");
if( mEditingConfig >= 0 ) { // Editing an account if( mEditingConfig >= 0 ) { // Editing an account
// If we are renaming the account, make sure that the new name // If we are renaming the account, make sure that the new name
// does not already exist // does not already exist
@ -249,7 +254,7 @@ void SyncWindow::on_buttonSave_clicked()
} }
if( okToEdit ) { if( okToEdit ) {
mAccounts[mEditingConfig]->initialize( mAccounts[mEditingConfig]->initialize(
ui->lineHost->text(), ui->labelHttp->text()+host,
ui->lineUser->text(), ui->lineUser->text(),
ui->linePassword->text(), ui->linePassword->text(),
ui->lineRemoteDir->text(), ui->lineRemoteDir->text(),
@ -263,7 +268,7 @@ void SyncWindow::on_buttonSave_clicked()
ui->lineName->setFocus(); ui->lineName->setFocus();
} else { // Good, create a new account } else { // Good, create a new account
OwnCloudSync *account = addAccount(ui->lineName->text()); OwnCloudSync *account = addAccount(ui->lineName->text());
account->initialize(ui->lineHost->text(), account->initialize(ui->labelHttp->text()+host,
ui->lineUser->text(), ui->lineUser->text(),
ui->linePassword->text(), ui->linePassword->text(),
ui->lineRemoteDir->text(), ui->lineRemoteDir->text(),
@ -580,11 +585,17 @@ void SyncWindow::slotAccountsSignalMapper(int row)
void SyncWindow::editConfig(int row) void SyncWindow::editConfig(int row)
{ {
QString host = mAccounts[row]->getHost();
if(host.contains("https://")) {
ui->checkBoxHostnameEncryption->setChecked(true);
}
host.replace("https://","");
host.replace("http://","");
mEditingConfig = row; mEditingConfig = row;
// Switch to the account editing widget // Switch to the account editing widget
ui->stackedWidget->setCurrentIndex(2); ui->stackedWidget->setCurrentIndex(2);
ui->lineName->setText(mAccounts[row]->getName()); ui->lineName->setText(mAccounts[row]->getName());
ui->lineHost->setText(mAccounts[row]->getHost()); ui->lineHost->setText(host);
ui->lineUser->setText(mAccounts[row]->getUserName()); ui->lineUser->setText(mAccounts[row]->getUserName());
ui->linePassword->setText(mAccounts[row]->getPassword()); ui->linePassword->setText(mAccounts[row]->getPassword());
ui->lineRemoteDir->setText(mAccounts[row]->getRemoteDirectory()); ui->lineRemoteDir->setText(mAccounts[row]->getRemoteDirectory());
@ -742,3 +753,12 @@ void SyncWindow::on_pushButton_2_clicked()
{ {
saveLogs(); saveLogs();
} }
void SyncWindow::on_checkBoxHostnameEncryption_stateChanged(int arg1)
{
if( arg1 == 0 ) {
ui->labelHttp->setText("http://");
} else {
ui->labelHttp->setText("https://");
}
}

View file

@ -139,6 +139,7 @@ private slots:
void on_buttonDeleteAccount_clicked(); void on_buttonDeleteAccount_clicked();
void on_pushButton_clicked(); void on_pushButton_clicked();
void on_pushButton_2_clicked(); void on_pushButton_2_clicked();
void on_checkBoxHostnameEncryption_stateChanged(int arg1);
}; };
#endif // SYNCWINDOW_H #endif // SYNCWINDOW_H

View file

@ -21,7 +21,7 @@
<number>0</number> <number>0</number>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>0</number> <number>2</number>
</property> </property>
<widget class="QWidget" name="page"> <widget class="QWidget" name="page">
<layout class="QGridLayout" name="gridLayout_2"> <layout class="QGridLayout" name="gridLayout_2">
@ -268,7 +268,7 @@ p, li { white-space: pre-wrap; }
&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;Enter your account details below. Leave off the /files/webdav.php on all remote references.&lt;/p&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;Enter your account details below. Leave off the /files/webdav.php on all remote references.&lt;/p&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; font-size:11pt; font-weight:600;&quot;&gt;No spaces on the account name!!&lt;/span&gt;&lt;/p&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; font-size:11pt; font-weight:600;&quot;&gt;No spaces on the account name!!&lt;/span&gt;&lt;/p&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;Enter any filters for files that you want to exclude. Only wildcard supported is *&lt;/p&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;Enter any filters for files that you want to exclude. Only wildcard supported is *&lt;/p&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;To delete account enable the button from he pop up menu. Then click the delete account button.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> &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;To delete account enable the button from the pop up menu. Then click the delete account button.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -287,14 +287,47 @@ p, li { white-space: pre-wrap; }
</widget> </widget>
</item> </item>
<item row="2" column="0"> <item row="2" column="0">
<widget class="QLabel" name="label_4"> <widget class="QLabel" name="labelHostname">
<property name="text"> <property name="text">
<string>Hostname: </string> <string>Hostname: </string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="1"> <item row="2" column="1">
<widget class="QLineEdit" name="lineHost"/> <widget class="QFrame" name="frame_6">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="labelHttp">
<property name="text">
<string>http://</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineHost">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBoxHostnameEncryption">
<property name="text">
<string>Encrypted</string>
</property>
</widget>
</item>
</layout>
</widget>
</item> </item>
<item row="3" column="0"> <item row="3" column="0">
<widget class="QLabel" name="label_2"> <widget class="QLabel" name="label_2">
@ -481,14 +514,14 @@ p, li { white-space: pre-wrap; }
<zorder>label_11</zorder> <zorder>label_11</zorder>
<zorder>label_5</zorder> <zorder>label_5</zorder>
<zorder>label_7</zorder> <zorder>label_7</zorder>
<zorder>label_4</zorder> <zorder>labelHostname</zorder>
<zorder>label_2</zorder> <zorder>label_2</zorder>
<zorder>lineUser</zorder> <zorder>lineUser</zorder>
<zorder>lineHost</zorder>
<zorder>label_6</zorder> <zorder>label_6</zorder>
<zorder>frame_4</zorder> <zorder>frame_4</zorder>
<zorder>frame_2</zorder> <zorder>frame_2</zorder>
<zorder>frame_3</zorder> <zorder>frame_3</zorder>
<zorder>frame_6</zorder>
</widget> </widget>
<widget class="QFrame" name="frameFilter"> <widget class="QFrame" name="frameFilter">
<property name="sizePolicy"> <property name="sizePolicy">