From 87fabfc772abc3632032b3ae24878ae8d5b5b40f Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Mon, 19 Oct 2009 16:22:45 +0200 Subject: Fixing title changes.. --- src/previewimage.cpp | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/previewimage.cpp b/src/previewimage.cpp index 0712b5a0..724d3744 100644 --- a/src/previewimage.cpp +++ b/src/previewimage.cpp @@ -133,10 +133,10 @@ void PreviewImage::snapFinished() m_imageLabel->setPixmap(m_pixmap); m_textLabel->setText(m_title); - kDebug() << "m_pixmap: " << m_pixmap.size(); - kDebug() << "text label: " << m_textLabel->size(); - kDebug() << "iamge label: " << m_imageLabel->size(); - kDebug() << "widget: " << size(); +// kDebug() << "m_pixmap: " << m_pixmap.size(); +// kDebug() << "text label: " << m_textLabel->size(); +// kDebug() << "image label: " << m_imageLabel->size(); +// kDebug() << "widget: " << size(); m_pixmap.save(m_savePath); @@ -167,16 +167,16 @@ void PreviewImage::showEmptyPreview() m_imageLabel->clear(); m_textLabel->clear(); - QVBoxLayout *layout = new QVBoxLayout; - m_button = new QToolButton(this); + m_button = new QToolButton(m_imageLabel); m_button->setDefaultAction(historyMenu()); m_button->setPopupMode(QToolButton::InstantPopup); m_button->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); m_button->setText(i18n("Add Preview")); m_button->setAutoRaise(true); m_button->setIconSize(QSize(48, 48)); - layout->addWidget(m_button); - m_imageLabel->setLayout(layout); + m_button->show(); + +// m_textLabel->setText( i18n("Add Preview") ); } @@ -257,7 +257,9 @@ KActionMenu* PreviewImage::historyMenu() { HistoryItem it = history.at(i); KAction *a = new KAction(Application::icon(it.url), it.title, this); - a->setData(it.url); + QStringList urlData; + urlData << it.url << it.title; + a->setData(urlData); connect(a, SIGNAL(triggered(bool)), this, SLOT(setUrlFromAction())); histMenu->addAction(a); } @@ -291,15 +293,18 @@ void PreviewImage::removeMe() void PreviewImage::setUrlFromAction() { KAction *a = qobject_cast(sender()); - KUrl url = KUrl(a->data().toString()); + QStringList urlData = a->data().toStringList(); + m_url = KUrl(urlData.at(0)); + m_title = urlData.at(1); + if(m_button) { m_imageLabel->layout()->deleteLater(); m_button->menu()->deleteLater(); m_button->deleteLater(); } - loadUrlPreview(url); + loadUrlPreview(m_url); } -- cgit v1.2.1