diff --git a/binary b/binary index 1fb9ddfa9..01d73965d 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 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::resizeEvent(QResizeEvent *e) +{ + QDialog::resizeEvent(e); + redrawElidedUrl(); +} + +void ShareDialog::redrawElidedUrl() +{ + QString u; + + if( !_shareUrl.isEmpty() ) { + QFontMetrics fm( _ui->_labelShareLink->font() ); + int linkLengthPixel = _ui->_labelShareLink->width(); + + const QUrl realUrl(_shareUrl); + QString elidedUrl = fm.elidedText(_shareUrl, Qt::ElideRight, linkLengthPixel); + + u = QString("%2").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() ) { - QFontMetrics fm( _ui->_labelShareLink->font() ); - int linkLengthPixel = _ui->_labelShareLink->width(); - - QString elidedUrl = fm.elidedText(url, Qt::ElideRight, linkLengthPixel); - - const QString u = QString("%2").arg(realUrl.toString(QUrl::None)).arg(elidedUrl); - _ui->_labelShareLink->setText(u); _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;