summaryrefslogtreecommitdiff
path: root/src/rekonqpage/previewchooser.cpp
diff options
context:
space:
mode:
authormatgic78 <matgic78@gmail.com>2009-12-31 10:53:51 +0100
committermatgic78 <matgic78@gmail.com>2010-02-06 11:22:46 +0100
commite3215b1316fa0459d4238bf5cb3c60b0bff90f73 (patch)
tree70a354c27e6fcd721c1bef70d9c8c09d2ea751e2 /src/rekonqpage/previewchooser.cpp
parentFix compilation after rebasing (diff)
downloadrekonq-e3215b1316fa0459d4238bf5cb3c60b0bff90f73.tar.xz
little changes
Diffstat (limited to 'src/rekonqpage/previewchooser.cpp')
-rw-r--r--src/rekonqpage/previewchooser.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/rekonqpage/previewchooser.cpp b/src/rekonqpage/previewchooser.cpp
index fde36563..eeea9f99 100644
--- a/src/rekonqpage/previewchooser.cpp
+++ b/src/rekonqpage/previewchooser.cpp
@@ -40,7 +40,7 @@
#include <KLocalizedString>
-PreviewChooser::PreviewChooser(int previewIndex)
+PreviewChooser::PreviewChooser(int previewIndex, QString url)
: KDialog(0)
, m_treeView(new QTreeView)
, m_model(new QStandardItemModel)
@@ -70,6 +70,15 @@ PreviewChooser::PreviewChooser(int previewIndex)
m_line = new KLineEdit;
connect(m_line, SIGNAL(textChanged(QString)), SLOT(urlChanged()));
urlLayout->addWidget(m_line);
+
+ if(url.isEmpty() || url.startsWith("about:"))
+ m_line->setText(QString("http://"));
+ else
+ {
+ m_line->setText(url);
+ m_line->setSelection(8, m_line->text().size());
+ }
+
// setup view
QVBoxLayout *vBoxLayout = new QVBoxLayout;
@@ -103,10 +112,10 @@ void PreviewChooser::refreshModel()
{
WebView *view = qobject_cast<WebView *>(mv->webTab(i)->view());
- if(view->url().scheme() == "about:")
+ if(view->url().scheme() == "about")
continue;
- QStandardItem *it = new QStandardItem(view->icon(), view->title());
+ QStandardItem *it = new QStandardItem(Application::icon(view->url()), view->title());
it->setData(QVariant(view->url()), Qt::ToolTipRole);
m_model->insertRow(i, it);
}
@@ -123,7 +132,7 @@ void PreviewChooser::setUrl(QModelIndex i)
void PreviewChooser::buttonClicked(KDialog::ButtonCode code)
{
- if(code == KDialog::Apply || code == KDialog::Ok)
+ if(code == KDialog::Apply || (code == KDialog::Ok && isButtonEnabled(KDialog::Apply)))
{
emit urlChoosed(m_previewIndex, KUrl(m_line->text()));
enableButtonApply(false);