Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/owncloud/client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKlaas Freitag <freitag@owncloud.com>2015-03-26 19:23:29 +0300
committerKlaas Freitag <freitag@owncloud.com>2015-04-07 14:38:01 +0300
commitb98040c7d5322b6b7ca1e9e0faf1118ce6da72bf (patch)
treef4ee61262270e334e3fac8fa121a8e288b80716c /src
parent1240a8163d41fea97f332121d1e367ea3fdfa560 (diff)
ShareDialog: handle resize properly with elided text
Diffstat (limited to 'src')
-rw-r--r--src/gui/sharedialog.cpp30
-rw-r--r--src/gui/sharedialog.h2
2 files changed, 25 insertions, 7 deletions
diff --git a/src/gui/sharedialog.cpp b/src/gui/sharedialog.cpp
index bbcf05b1c..a1d67a03e 100644
--- a/src/gui/sharedialog.cpp
+++ b/src/gui/sharedialog.cpp
@@ -327,24 +327,40 @@ void ShareDialog::slotSharesFetched(const QString &reply)
}
}
-void ShareDialog::setShareLink( const QString& url )
+void ShareDialog::resizeEvent(QResizeEvent *e)
{
- // FIXME: shorten the url for output.
- const QUrl realUrl(url);
- if( realUrl.isValid() ) {
+ QDialog::resizeEvent(e);
+ redrawElidedUrl();
+}
+
+void ShareDialog::redrawElidedUrl()
+{
+ QString u;
+
+ if( !_shareUrl.isEmpty() ) {
QFontMetrics fm( _ui->_labelShareLink->font() );
int linkLengthPixel = _ui->_labelShareLink->width();
- QString elidedUrl = fm.elidedText(url, Qt::ElideRight, linkLengthPixel);
+ const QUrl realUrl(_shareUrl);
+ QString elidedUrl = fm.elidedText(_shareUrl, Qt::ElideRight, linkLengthPixel);
- const QString u = QString("<a href=\"%1\">%2</a>").arg(realUrl.toString(QUrl::None)).arg(elidedUrl);
- _ui->_labelShareLink->setText(u);
+ u = QString("<a href=\"%1\">%2</a>").arg(realUrl.toString(QUrl::None)).arg(elidedUrl);
+ }
+ _ui->_labelShareLink->setText(u);
+}
+
+void ShareDialog::setShareLink( const QString& url )
+{
+ // FIXME: shorten the url for output.
+ const QUrl realUrl(url);
+ if( realUrl.isValid() ) {
_shareUrl = url;
_ui->pushButton_copy->setEnabled(true);
} else {
_shareUrl.clear();
_ui->_labelShareLink->setText(QString::null);
}
+ redrawElidedUrl();
}
diff --git a/src/gui/sharedialog.h b/src/gui/sharedialog.h
index 50710de38..d71317662 100644
--- a/src/gui/sharedialog.h
+++ b/src/gui/sharedialog.h
@@ -81,6 +81,8 @@ private:
void displayError(int code);
void displayError(const QString& errMsg);
void setShareLink( const QString& url );
+ void resizeEvent(QResizeEvent *e);
+ void redrawElidedUrl();
Ui::ShareDialog *_ui;
AccountPtr _account;