From e3215b1316fa0459d4238bf5cb3c60b0bff90f73 Mon Sep 17 00:00:00 2001 From: matgic78 Date: Thu, 31 Dec 2009 10:53:51 +0100 Subject: little changes --- src/rekonqpage/newtabpage.cpp | 4 +++- src/rekonqpage/previewchooser.cpp | 17 +++++++++++++---- src/rekonqpage/previewchooser.h | 2 +- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/rekonqpage/newtabpage.cpp b/src/rekonqpage/newtabpage.cpp index c91af2dc..c8b2e916 100644 --- a/src/rekonqpage/newtabpage.cpp +++ b/src/rekonqpage/newtabpage.cpp @@ -84,7 +84,9 @@ void NewTabPage::generate(const KUrl &url) } if(url.directory() == QString("preview/modify")) { - PreviewChooser *pc = new PreviewChooser(url.fileName().toInt()); + int index = url.fileName().toInt(); + QString url = m_root.findFirst("#preview" + QVariant(index).toString() + " > a").attribute("href"); + PreviewChooser *pc = new PreviewChooser(index, url); connect(pc, SIGNAL(urlChoosed(int,KUrl)), SLOT(setPreview(int,KUrl))); pc->show(); return; 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 -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(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); diff --git a/src/rekonqpage/previewchooser.h b/src/rekonqpage/previewchooser.h index 79766fdc..3eae71db 100644 --- a/src/rekonqpage/previewchooser.h +++ b/src/rekonqpage/previewchooser.h @@ -46,7 +46,7 @@ class PreviewChooser : public KDialog Q_OBJECT public: - explicit PreviewChooser(int previewIndex); + explicit PreviewChooser(int previewIndex, QString url); virtual ~PreviewChooser(); signals: -- cgit v1.2.1