diff options
| -rw-r--r-- | src/homepage.cpp | 12 | ||||
| -rw-r--r-- | src/homepage.h | 2 | ||||
| -rw-r--r-- | src/mainview.cpp | 24 | ||||
| -rw-r--r-- | src/mainview.h | 1 | ||||
| -rw-r--r-- | src/mainwindow.cpp | 2 | ||||
| -rw-r--r-- | src/settings.cpp | 28 | ||||
| -rw-r--r-- | src/settings.h | 5 | ||||
| -rw-r--r-- | src/websnap.cpp | 8 | 
8 files changed, 40 insertions, 42 deletions
| diff --git a/src/homepage.cpp b/src/homepage.cpp index 1f759108..52668036 100644 --- a/src/homepage.cpp +++ b/src/homepage.cpp @@ -97,7 +97,15 @@ QString HomePage::speedDial()      {          QString fileName = QString("thumb") + QString::number(i) + QString(".png");          QString path = KStandardDirs::locateLocal("cache", QString("thumbs/") + fileName, true); -         +        if( !QFile::exists(path) ) +        { +            kDebug() << "websnap" << i << "========================================================="; +            WebSnap *ws = new WebSnap(urls.at(i), fileName); +             +            // we need polish being in an extant object!! +            connect(ws, SIGNAL(finished()), Application::instance()->mainWindow()->mainView(), SLOT(polish())); +        } +          speed += "<div class=\"thumbnail\">";          speed += "<a href=\"" + urls.at(i) + "\">";          speed += "<img src=\"" + path + "\" width=\"200\" alt=\"" + names.at(i) + "\" />"; @@ -173,4 +181,4 @@ QString HomePage::fillRecentHistory()      return history; -}
\ No newline at end of file +} diff --git a/src/homepage.h b/src/homepage.h index 82117664..7604f0c3 100644 --- a/src/homepage.h +++ b/src/homepage.h @@ -40,7 +40,7 @@ class HomePage : public QObject  Q_OBJECT  public: -    HomePage(QObject *parent = 0); +    HomePage(QObject *parent);      ~HomePage();      QString rekonqHomePage(); diff --git a/src/mainview.cpp b/src/mainview.cpp index a40729a3..2a3545b4 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -42,6 +42,7 @@  #include "webview.h"  #include "sessionmanager.h"  #include "homepage.h" +#include "websnap.h"  // KDE Includes  #include <KUrl> @@ -299,7 +300,7 @@ void MainView::newTab()      urlBar()->setUrl(KUrl(""));      urlBar()->setFocus(); -    HomePage p; +    HomePage p(w);      switch(ReKonfig::newTabsBehaviour())      { @@ -593,3 +594,24 @@ KUrl::List MainView::recentlyClosedTabs()  {      return m_recentlyClosedTabs;  } + + +void MainView::polish() +{ +    static int i = 0; +    WebSnap *ws = qobject_cast<WebSnap*>(sender()); +    delete ws; +     +    i++; +    if(i<9) +    { +        WebView *w = currentWebView(); +        HomePage p(w); +        w->setHtml( p.rekonqHomePage() ); +        kDebug() << "ciao---------------------------------------------____"; +    } +    else +    { +        kDebug() << "EROORORORORORORORORORO"; +    } +} diff --git a/src/mainview.h b/src/mainview.h index ba79d9f8..1ba4a63d 100644 --- a/src/mainview.h +++ b/src/mainview.h @@ -124,6 +124,7 @@ public slots:      void slotWebReload();      void slotWebStop(); +    void polish();  private slots:      void slotCurrentChanged(int index); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 1dc56f7a..5a095a72 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -743,7 +743,7 @@ void MainWindow::slotHome()      if(ReKonfig::useNewTabPage())      { -        HomePage p; +        HomePage p(w);          w->setHtml( p.rekonqHomePage(), QUrl());      }      else diff --git a/src/settings.cpp b/src/settings.cpp index dd61e357..9767b676 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -139,7 +139,6 @@ Private::Private(SettingsDialog *parent)  SettingsDialog::SettingsDialog(QWidget *parent)          : KConfigDialog(parent, "rekonfig", ReKonfig::self())          , d(new Private(this)) -        , m_progress(0)  {      setFaceType(KPageDialog::List);      showButtonSeparator(true); @@ -156,7 +155,6 @@ SettingsDialog::SettingsDialog(QWidget *parent)      connect(this, SIGNAL(applyClicked()), this, SLOT(saveSettings()));      connect(this, SIGNAL(okClicked()), this, SLOT(saveSettings())); -    connect(this, SIGNAL(okClicked()), this, SLOT(updateSnaps()));      setWebSettingsToolTips();  } @@ -253,29 +251,3 @@ void SettingsDialog::setHomeToCurrentPage()          d->generalUi.kcfg_homePage->setText(webView->url().prettyUrl());      }  } - - -void SettingsDialog::updateSnaps() -{ -    if(hasChanged()) -    { -        QStringList urls = ReKonfig::previewUrls(); -        for(int i=0; i<9; ++i) -        { -            QString fileName = QString("thumb") + QString::number(i) + QString(".png"); -            WebSnap *ws = new WebSnap(urls.at(i), fileName); -            connect(ws, SIGNAL(finished()), this, SLOT(polish())); -        } -        m_progress = new KProgressDialog(this, i18n("Loading..."), i18n("Retrieving site images...")); -        m_progress->progressBar()->setRange(0,8); -        m_progress->show(); -    } -} - - -void SettingsDialog::polish() -{ -    WebSnap *ws = qobject_cast<WebSnap*>(sender()); -    delete ws; -    m_progress->progressBar()->setValue( m_progress->progressBar()->value() + 1); -}
\ No newline at end of file diff --git a/src/settings.h b/src/settings.h index 9278d758..0be89173 100644 --- a/src/settings.h +++ b/src/settings.h @@ -31,7 +31,6 @@  // KDE Includes  #include <KConfigDialog> -#include <KProgressDialog>  // Forward Declarations  class QWidget; @@ -51,15 +50,11 @@ private:      Private* const d;      void setWebSettingsToolTips(); -    KProgressDialog *m_progress;  private slots:      void readConfig();      void saveSettings();      void setHomeToCurrentPage(); - -    void updateSnaps(); -    void polish();  };  #endif // SETTINGS_H diff --git a/src/websnap.cpp b/src/websnap.cpp index 05ea17a9..1f564223 100644 --- a/src/websnap.cpp +++ b/src/websnap.cpp @@ -65,7 +65,6 @@ void WebSnap::saveResult(bool ok)      if (!ok)       {          kDebug() << "Error loading site.."; -        emit finished();          return;      } @@ -85,7 +84,8 @@ void WebSnap::saveResult(bool ok)      m_image = m_image.scaled(m_targetSize, Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation);      QString path = KStandardDirs::locateLocal("cache", QString("thumbs/") + m_fileName, true); -    m_image.save( path ); - -    emit finished(); +    if( m_image.save(path) ) +    { +        emit finished(); +    }  } | 
