[Pkg-owncloud-commits] [owncloud-client] 75/159: ShareDialog: handle resize properly with elided text
Sandro Knauß
hefee-guest at moszumanska.debian.org
Fri May 1 13:05:24 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 b98040c7d5322b6b7ca1e9e0faf1118ce6da72bf
Author: Klaas Freitag <freitag at owncloud.com>
Date: Thu Mar 26 17:23:29 2015 +0100
ShareDialog: handle resize properly with elided text
---
binary | 2 +-
src/gui/sharedialog.cpp | 30 +++++++++++++++++++++++-------
src/gui/sharedialog.h | 2 ++
3 files changed, 26 insertions(+), 8 deletions(-)
diff --git a/binary b/binary
index 1fb9ddf..01d7396 160000
--- a/binary
+++ b/binary
@@ -1 +1 @@
-Subproject commit 1fb9ddfa9a9a1b4dbc447eee10dbed89172d968a
+Subproject commit 01d73965dc8b862d1b2310d3ef801c297b697ec7
diff --git a/src/gui/sharedialog.cpp b/src/gui/sharedialog.cpp
index bbcf05b..a1d67a0 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 50710de..d713176 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;
--
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