[Pkg-owncloud-commits] [owncloud-client] 111/164: ShareDialog: Made it less "webbish" for better usability.
Sandro Knauß
hefee-guest at moszumanska.debian.org
Sun Mar 22 11:57:00 UTC 2015
This is an automated email from the git hooks/post-receive script.
hefee-guest pushed a commit to branch master
in repository owncloud-client.
commit b09e08c06f9c150dea105edfc2730b5ab01e49e6
Author: Klaas Freitag <freitag at owncloud.com>
Date: Mon Mar 9 14:33:02 2015 +0100
ShareDialog: Made it less "webbish" for better usability.
- Check the share checkbox automatically on open of the dialog
- Use the date picker with popping up calendar
- Proper initial size
- no resizing and appearing and disappearing.
Fixes probably #2917, also #2764
---
src/gui/sharedialog.cpp | 80 +++++++++++------
src/gui/sharedialog.h | 4 +
src/gui/sharedialog.ui | 233 +++++++++++++++++++++++++++---------------------
3 files changed, 188 insertions(+), 129 deletions(-)
diff --git a/src/gui/sharedialog.cpp b/src/gui/sharedialog.cpp
index b81338d..4fce730 100644
--- a/src/gui/sharedialog.cpp
+++ b/src/gui/sharedialog.cpp
@@ -45,7 +45,7 @@ ShareDialog::ShareDialog(AccountPtr account, const QString &sharePath, const QSt
setAttribute(Qt::WA_DeleteOnClose);
_ui->setupUi(this);
_ui->pushButton_copy->setIcon(QIcon::fromTheme("edit-copy"));
- _ui->pushButton_copy->setText(tr("Copy Link"));
+ _ui->pushButton_copy->setEnabled(false);
connect(_ui->pushButton_copy, SIGNAL(clicked(bool)), SLOT(slotPushButtonCopyLinkPressed()));
QPushButton *closeButton = _ui->buttonBox->button(QDialogButtonBox::Close);
@@ -60,7 +60,7 @@ ShareDialog::ShareDialog(AccountPtr account, const QString &sharePath, const QSt
_pi_date = new QProgressIndicator();
_ui->horizontalLayout_shareLink->addWidget(_pi_link);
_ui->horizontalLayout_password->addWidget(_pi_password);
- _ui->horizontalLayout_expire->addWidget(_pi_date);
+ // _ui->horizontalLayout_expire->addWidget(_pi_date);
connect(_ui->checkBox_shareLink, SIGNAL(clicked()), this, SLOT(slotCheckBoxShareLinkClicked()));
connect(_ui->checkBox_password, SIGNAL(clicked()), this, SLOT(slotCheckBoxPasswordClicked()));
@@ -72,7 +72,9 @@ ShareDialog::ShareDialog(AccountPtr account, const QString &sharePath, const QSt
_ui->widget_shareLink->hide();
_ui->lineEdit_password->hide();
_ui->pushButton_setPassword->hide();
- _ui->calendar->hide();
+
+ _ui->calendar->setDate(QDate::currentDate().addDays(1));
+ _ui->calendar->setEnabled(false);
QFileInfo f_info(_localPath);
QFileIconProvider icon_provider;
@@ -96,7 +98,7 @@ ShareDialog::ShareDialog(AccountPtr account, const QString &sharePath, const QSt
_ui->label_sharePath->setWordWrap(true);
_ui->label_sharePath->setText(tr("%1 path: %2").arg(Theme::instance()->appNameGUI()).arg(_sharePath));
this->setWindowTitle(tr("%1 Sharing").arg(Theme::instance()->appNameGUI()));
- _ui->label_password->setText(tr("Set password"));
+ _ui->label_password->setText(tr("Set p&assword"));
// check if the file is already inside of a synced folder
if( sharePath.isEmpty() ) {
// The file is not yet in an ownCloud synced folder. We could automatically
@@ -199,7 +201,7 @@ void ShareDialog::setPassword(const QString &password)
verb = "POST";
if( _ui->checkBox_expire->isChecked() ) {
- QDate date = _ui->calendar->selectedDate();
+ QDate date = _ui->calendar->date();
if( date.isValid() ) {
requestParams.append(qMakePair(QString::fromLatin1("expireDate"), date.toString("yyyy-MM-dd")));
}
@@ -281,12 +283,12 @@ void ShareDialog::slotSharesFetched(const QString &reply)
}
if (data.value("expiration").isValid()) {
- _ui->calendar->setSelectedDate(QDate::fromString(data.value("expiration").toString(), "yyyy-MM-dd 00:00:00"));
+ _ui->calendar->setDate(QDate::fromString(data.value("expiration").toString(), "yyyy-MM-dd 00:00:00"));
_ui->calendar->setMinimumDate(QDate::currentDate().addDays(1));
- _ui->calendar->show();
+ _ui->calendar->setEnabled(true);
_ui->checkBox_expire->setChecked(true);
} else {
- _ui->calendar->hide();
+ _ui->calendar->setEnabled(false);
_ui->checkBox_expire->setChecked(false);
}
@@ -300,10 +302,34 @@ void ShareDialog::slotSharesFetched(const QString &reply)
queryArgs.append(qMakePair(QString("t"), data.value("token").toString()));
url = Account::concatUrlPath(_account->url(), QLatin1String("public.php"), queryArgs).toString();
}
- _ui->lineEdit_shareLink->setText(url);
+ setShareLink(url);
+
+ _ui->pushButton_copy->setEnabled(true);
}
}
- setShareCheckBoxTitle(_shares.count() > 0);
+ if( _shares.count()>0 ) {
+ setShareCheckBoxTitle(true);
+ } else {
+ // check the checkbox to create a link.
+ _ui->checkBox_shareLink->setChecked(true);
+ slotCheckBoxShareLinkClicked();
+ }
+}
+
+void ShareDialog::setShareLink( const QString& url )
+{
+ // FIXME: shorten the url for output.
+ const QUrl realUrl(url);
+ if( realUrl.isValid() ) {
+ const QString u = QString("<a href=\"%1\">%2</a>").arg(realUrl.toString(QUrl::None)).arg(url);
+ _ui->_labelShareLink->setText(u);
+ _shareUrl = url;
+ _ui->pushButton_copy->setEnabled(true);
+ } else {
+ _shareUrl.clear();
+ _ui->_labelShareLink->setText(QString::null);
+ }
+
}
void ShareDialog::slotDeleteShareFetched(const QString &reply)
@@ -319,12 +345,16 @@ void ShareDialog::slotDeleteShareFetched(const QString &reply)
_public_share_id = 0;
_pi_link->stopAnimation();
_ui->lineEdit_password->clear();
- _ui->lineEdit_shareLink->clear();
+ _ui->_labelShareLink->clear();
+ _ui->pushButton_copy->setEnabled(false);
_ui->widget_shareLink->hide();
_ui->lineEdit_password->hide();
_ui->pushButton_setPassword->hide();
_ui->checkBox_expire->setChecked(false);
- _ui->calendar->hide();
+ _ui->checkBox_password->setChecked(false);
+ _ui->calendar->setEnabled(false);
+
+ _shareUrl.clear();
setShareCheckBoxTitle(false);
@@ -361,7 +391,7 @@ void ShareDialog::slotCreateShareFetched(const QString &reply)
// there needs to be a password
_ui->checkBox_password->setChecked(true);
_ui->checkBox_password->setVisible(false);
- _ui->label_password->setText(tr("Public sharing requires a password:"));
+ _ui->label_password->setText(tr("Public shå requires a password:"));
_ui->lineEdit_password->setFocus();
_ui->widget_shareLink->show();
@@ -376,7 +406,9 @@ void ShareDialog::slotCreateShareFetched(const QString &reply)
QVariantMap json = QtJson::parse(reply, success).toMap();
_public_share_id = json.value("ocs").toMap().values("data")[0].toMap().value("id").toULongLong();
QString url = json.value("ocs").toMap().values("data")[0].toMap().value("url").toString();
- _ui->lineEdit_shareLink->setText(url);
+
+ setShareLink(url);
+
setShareCheckBoxTitle(true);
_ui->widget_shareLink->show();
@@ -384,14 +416,12 @@ void ShareDialog::slotCreateShareFetched(const QString &reply)
void ShareDialog::slotCheckBoxPasswordClicked()
{
- if (_ui->checkBox_password->checkState() == Qt::Checked)
- {
+ if (_ui->checkBox_password->checkState() == Qt::Checked) {
_ui->lineEdit_password->show();
_ui->pushButton_setPassword->show();
_ui->lineEdit_password->setPlaceholderText(tr("Choose a password for the public link"));
- }
- else
- {
+ _ui->lineEdit_password->setFocus();
+ } else {
ShareDialog::setPassword(QString());
_ui->lineEdit_password->setPlaceholderText(QString());
_pi_password->startAnimation();
@@ -406,21 +436,21 @@ void ShareDialog::slotCheckBoxExpireClicked()
{
const QDate date = QDate::currentDate().addDays(1);
ShareDialog::setExpireDate(date);
- _ui->calendar->setSelectedDate(date);
+ _ui->calendar->setDate(date);
_ui->calendar->setMinimumDate(date);
- _ui->calendar->show();
+ _ui->calendar->setEnabled(true);
}
else
{
ShareDialog::setExpireDate(QDate());
- _ui->calendar->hide();
+ _ui->calendar->setEnabled(false);
}
}
void ShareDialog::slotPushButtonCopyLinkPressed()
{
QClipboard *clipboard = QApplication::clipboard();
- clipboard->setText(_ui->lineEdit_shareLink->text());
+ clipboard->setText(_shareUrl);
}
int ShareDialog::checkJsonReturnCode(const QString &reply, QString &message)
@@ -441,8 +471,8 @@ int ShareDialog::checkJsonReturnCode(const QString &reply, QString &message)
void ShareDialog::setShareCheckBoxTitle(bool haveShares)
{
- const QString noSharesTitle(tr("Check to share by public link"));
- const QString haveSharesTitle(tr("Shared by public link (uncheck to delete share)"));
+ const QString noSharesTitle(tr("Check to &share by public link"));
+ const QString haveSharesTitle(tr("&Shared by public link (uncheck to delete share)"));
if( haveShares ) {
_ui->checkBox_shareLink->setText( haveSharesTitle );
diff --git a/src/gui/sharedialog.h b/src/gui/sharedialog.h
index a8e498f..997e17e 100644
--- a/src/gui/sharedialog.h
+++ b/src/gui/sharedialog.h
@@ -78,14 +78,18 @@ private:
void setShareCheckBoxTitle(bool haveShares);
void displayError(int code);
void displayInfo( const QString& msg );
+ void setShareLink( const QString& url );
Ui::ShareDialog *_ui;
AccountPtr _account;
QString _sharePath;
QString _localPath;
+ QString _shareUrl;
+#if 0
QString _folderAlias;
int _uploadFails;
QString _expectedSyncFile;
+#endif
bool _passwordJobRunning;
QList<QVariant> _shares;
diff --git a/src/gui/sharedialog.ui b/src/gui/sharedialog.ui
index d0c5f82..c3194b0 100644
--- a/src/gui/sharedialog.ui
+++ b/src/gui/sharedialog.ui
@@ -6,84 +6,74 @@
<rect>
<x>0</x>
<y>0</y>
- <width>362</width>
- <height>427</height>
+ <width>403</width>
+ <height>296</height>
</rect>
</property>
<property name="windowTitle">
<string>Share NewDocument.odt</string>
</property>
<layout class="QGridLayout" name="gridLayout_4">
- <item row="0" column="0">
- <widget class="QGroupBox" name="groupBox">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="title">
- <string>Share Info</string>
+ <item row="4" column="0">
+ <widget class="QLabel" name="errorLabel">
+ <property name="text">
+ <string>TextLabel</string>
</property>
- <layout class="QGridLayout" name="gridLayout_2">
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <layout class="QHBoxLayout" name="horizontalLayout_shareLink">
+ <item>
+ <widget class="QCheckBox" name="checkBox_shareLink">
+ <property name="text">
+ <string>Share link</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="2" column="0" colspan="2">
+ <widget class="QWidget" name="widget_shareLink" native="true">
+ <layout class="QGridLayout" name="gridLayout_3">
+ <property name="topMargin">
+ <number>0</number>
+ </property>
<item row="0" column="0">
- <layout class="QGridLayout" name="gridLayout">
- <item row="0" column="0" rowspan="2">
- <widget class="QLabel" name="label_icon">
- <property name="text">
- <string>TextLabel</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QLabel" name="label_name">
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <property name="sizeConstraint">
+ <enum>QLayout::SetDefaultConstraint</enum>
+ </property>
+ <item>
+ <widget class="QLabel" name="_labelShareLink">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
- <property name="font">
- <font>
- <weight>75</weight>
- <bold>true</bold>
- </font>
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
</property>
<property name="text">
- <string>share label</string>
+ <string/>
</property>
- </widget>
- </item>
- <item row="0" column="2" rowspan="2">
- <widget class="QProgressIndicator" name="pi_share" native="true"/>
- </item>
- <item row="1" column="1">
- <widget class="QLabel" name="label_sharePath">
- <property name="sizePolicy">
- <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
+ <property name="textFormat">
+ <enum>Qt::RichText</enum>
</property>
- <property name="font">
- <font>
- <weight>50</weight>
- <bold>false</bold>
- </font>
+ <property name="openExternalLinks">
+ <bool>true</bool>
</property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="pushButton_copy">
<property name="text">
- <string>ownCloud Path:</string>
+ <string>Copy &Link</string>
</property>
</widget>
</item>
</layout>
</item>
- </layout>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QWidget" name="widget_shareLink" native="true">
- <layout class="QGridLayout" name="gridLayout_3">
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_password">
<item>
@@ -102,18 +92,10 @@
<item>
<widget class="QLabel" name="label_password">
<property name="text">
- <string>Set password</string>
+ <string>Set p&assword</string>
</property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="3" column="0">
- <layout class="QHBoxLayout" name="horizontalLayout_expire">
- <item>
- <widget class="QCheckBox" name="checkBox_expire">
- <property name="text">
- <string>Set expiration date</string>
+ <property name="buddy">
+ <cstring>checkBox_password</cstring>
</property>
</widget>
</item>
@@ -131,31 +113,99 @@
<item>
<widget class="QPushButton" name="pushButton_setPassword">
<property name="text">
- <string>Set Password</string>
+ <string>Set &Password</string>
</property>
</widget>
</item>
</layout>
</item>
- <item row="4" column="0">
- <widget class="QCalendarWidget" name="calendar"/>
- </item>
- <item row="0" column="0">
- <layout class="QHBoxLayout" name="horizontalLayout_3">
- <property name="sizeConstraint">
- <enum>QLayout::SetDefaultConstraint</enum>
- </property>
+ <item row="3" column="0">
+ <layout class="QHBoxLayout" name="horizontalLayout">
<item>
- <widget class="QLineEdit" name="lineEdit_shareLink">
- <property name="readOnly">
- <bool>true</bool>
+ <widget class="QCheckBox" name="checkBox_expire">
+ <property name="text">
+ <string>Set &expiration date</string>
</property>
</widget>
</item>
<item>
- <widget class="QPushButton" name="pushButton_copy">
+ <widget class="QDateEdit" name="calendar">
+ <property name="calendarPopup">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="5" column="0">
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Close</set>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="0" colspan="2">
+ <widget class="QGroupBox" name="groupBox">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Share Info</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_2">
+ <item row="0" column="0">
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0" rowspan="2">
+ <widget class="QLabel" name="label_icon">
<property name="text">
- <string/>
+ <string>TextLabel</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QLabel" name="label_name">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="font">
+ <font>
+ <weight>75</weight>
+ <bold>true</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>share label</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="2" rowspan="2">
+ <widget class="QProgressIndicator" name="pi_share" native="true"/>
+ </item>
+ <item row="1" column="1">
+ <widget class="QLabel" name="label_sharePath">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="font">
+ <font>
+ <weight>50</weight>
+ <bold>false</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>ownCloud Path:</string>
</property>
</widget>
</item>
@@ -164,7 +214,7 @@
</layout>
</widget>
</item>
- <item row="3" column="0">
+ <item row="3" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
@@ -177,31 +227,6 @@
</property>
</spacer>
</item>
- <item row="1" column="0">
- <layout class="QHBoxLayout" name="horizontalLayout_shareLink">
- <item>
- <widget class="QCheckBox" name="checkBox_shareLink">
- <property name="text">
- <string>Share link</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="4" column="0">
- <widget class="QLabel" name="errorLabel">
- <property name="text">
- <string>TextLabel</string>
- </property>
- </widget>
- </item>
- <item row="5" column="0">
- <widget class="QDialogButtonBox" name="buttonBox">
- <property name="standardButtons">
- <set>QDialogButtonBox::Close</set>
- </property>
- </widget>
- </item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git
More information about the Pkg-owncloud-commits
mailing list