diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/application.cpp | 62 | ||||
-rw-r--r-- | src/homepage.cpp | 3 | ||||
-rw-r--r-- | src/main.cpp | 5 | ||||
-rw-r--r-- | src/mainview.cpp | 1 | ||||
-rw-r--r-- | src/mainwindow.cpp | 2 | ||||
-rw-r--r-- | src/previewimage.cpp | 17 | ||||
-rw-r--r-- | src/rekonq.kcfg | 5 | ||||
-rw-r--r-- | src/settings.cpp | 8 | ||||
-rw-r--r-- | src/settings_general.ui | 11 | ||||
-rw-r--r-- | src/websnap.cpp | 10 |
10 files changed, 63 insertions, 61 deletions
diff --git a/src/application.cpp b/src/application.cpp index 4c819aba..ffde7203 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -52,6 +52,7 @@ #include <KUriFilter> #include <KMessageBox> #include <KProtocolInfo> +#include <KWindowInfo> // Qt Includes #include <QRegExp> @@ -87,43 +88,46 @@ int Application::newInstance() KCmdLineArgs::setCwd(QDir::currentPath().toUtf8()); KCmdLineArgs* args = KCmdLineArgs::parsedArgs(); + // is your app session restored? restore session... + if (isSessionRestored()) + { + sessionManager()->restoreSession(); + return 0; + } + if (args->count() > 0) { - // opening links in new tabs in ONE window - if(ReKonfig::externalUrlNewTab()) - { - // creating 1st new window - newMainWindow(); - loadUrl(args->arg(0)); - - for (int i = 1; i < args->count(); ++i) - { - loadUrl(args->arg(i), Rekonq::NewCurrentTab); - } - args->clear(); - - } - else + // is there a window open on the current desktop ? use it! + for (int i = 0; i < m_mainWindows.size(); ++i) { - // opening ONE window for each URL - for (int i = 0; i < args->count(); ++i) + MainWindow *m = m_mainWindows.at(i); + KWindowInfo w = KWindowInfo(m->winId(), NET::WMDesktop); + if(w.isOnCurrentDesktop()) { - loadUrl(args->arg(i), Rekonq::NewWindow); + m->activateWindow(); + m->raise(); + + for (int i = 0; i < args->count(); ++i) + loadUrl(args->arg(i), Rekonq::NewCurrentTab); + + return 1; } - args->clear(); - } - } - else - { - if(!isSessionRestored()) - { - // creating new window - MainWindow *w = newMainWindow(); - w->slotHome(); } + + // No windows in the current desktop? No windows at all? + // Create a new one and load there sites... + loadUrl(args->arg(0), Rekonq::NewWindow); + for (int i = 1; i < args->count(); ++i) + loadUrl(args->arg(i), Rekonq::SettingOpenTab); + + return 2; } + + // creating new window + MainWindow *w = newMainWindow(); + w->slotHome(); - return 0; + return 3; } diff --git a/src/homepage.cpp b/src/homepage.cpp index 14db5806..aa679999 100644 --- a/src/homepage.cpp +++ b/src/homepage.cpp @@ -95,13 +95,12 @@ QString HomePage::speedDial() for(int i = 0; i< urls.count(); ++i) { speed += "<div class=\"thumbnail\">"; - speed += "<a href=\"" + urls.at(i) + "\">"; speed += "<object type=\"application/image-preview\" width=\"200\">"; speed += "<param name=\"url\" value=\"" + urls.at(i) + "\">"; speed += "<param name=\"position\" value=\"" + QString::number(i) + "\">"; speed += "</object>"; speed += "<br />"; - speed += names.at(i) + "</a></div>"; + speed += "<a href=\"" + urls.at(i) + "\">" + names.at(i) + "</a></div>"; } return speed; } diff --git a/src/main.cpp b/src/main.cpp index 01054fc3..4518d8cf 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -129,10 +129,5 @@ int main(int argc, char **argv) Application app; - if( app.isSessionRestored() ) - { - Application::sessionManager()->restoreSession(); - } - return app.exec(); } diff --git a/src/mainview.cpp b/src/mainview.cpp index e2b6e1bb..87dbfaa1 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -85,6 +85,7 @@ MainView::MainView(QWidget *parent) // connecting tabbar signals connect(m_tabBar, SIGNAL(closeTab(int)), this, SLOT(slotCloseTab(int))); connect(m_tabBar, SIGNAL(mouseMiddleClick(int)), this, SLOT(slotCloseTab(int))); + connect(m_tabBar, SIGNAL(newTabRequest()), this, SLOT(newTab())); connect(m_tabBar, SIGNAL(cloneTab(int)), this, SLOT(slotCloneTab(int))); connect(m_tabBar, SIGNAL(closeOtherTabs(int)), this, SLOT(slotCloseOtherTabs(int))); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 5a095a72..8b4f5c6c 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -741,7 +741,7 @@ void MainWindow::slotHome() { WebView *w = currentTab(); - if(ReKonfig::useNewTabPage()) + if(ReKonfig::newTabHomePage()) { HomePage p(w); w->setHtml( p.rekonqHomePage(), QUrl()); diff --git a/src/previewimage.cpp b/src/previewimage.cpp index d027bfd1..b78f9ae5 100644 --- a/src/previewimage.cpp +++ b/src/previewimage.cpp @@ -27,6 +27,7 @@ #include "previewimage.moc" #include <QFile> +#include <QMovie> #include <KUrl> #include <KStandardDirs> @@ -46,22 +47,28 @@ PreviewImage::PreviewImage(const QString &url, const QString &pos) } else { - QString path = KStandardDirs::locate("appdata", "pics/loading.mng"); - setPixmap( QPixmap(path) ); - ws = new WebSnap( url, pos ); connect(ws, SIGNAL(finished()), this, SLOT(setSiteImage())); + + QString path = KStandardDirs::locate("appdata", "pics/busywidget.gif"); + + QMovie *movie = new QMovie(path, QByteArray(), this); + movie->setSpeed(50); + setMovie(movie); + movie->start(); } } PreviewImage::~PreviewImage() { - kDebug() << "bye bye.."; } void PreviewImage::setSiteImage() { - kDebug() << "Done. works?"; + QMovie *m = movie(); + delete m; + setMovie(0); + setPixmap( ws->previewImage() ); } diff --git a/src/rekonq.kcfg b/src/rekonq.kcfg index 3de675f8..354e3719 100644 --- a/src/rekonq.kcfg +++ b/src/rekonq.kcfg @@ -25,7 +25,7 @@ <!-- General Settings --> <group name="General"> - <entry name="useNewTabPage" type="Bool"> + <entry name="newTabHomePage" type="Bool"> <default>true</default> </entry> <entry name="newTabsBehaviour" type="Int"> @@ -37,9 +37,6 @@ <entry name="openTabNoWindow" type="Bool"> <default>true</default> </entry> - <entry name="externalUrlNewTab" type="Bool"> - <default>true</default> - </entry> <entry name="alwaysShowTabBar" type="Bool"> <default>true</default> </entry> diff --git a/src/settings.cpp b/src/settings.cpp index 1950c40a..57793888 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -185,6 +185,12 @@ void SettingsDialog::setWebSettingsToolTips() // we need this function to UPDATE the config widget data.. void SettingsDialog::readConfig() { + // ======= General Page + if( ReKonfig::newTabHomePage() ) + d->generalUi.rbUseNewTabPage->setChecked( true ); + else + d->generalUi.rbUseHomePage->setChecked( true ); + // ====== New Tab Page QTableWidget *t = d->newtabpageUi.tableWidget; QStringList names, urls; @@ -220,6 +226,8 @@ void SettingsDialog::readConfig() // we need this function to SAVE settings in rc file.. void SettingsDialog::saveSettings() { + ReKonfig::setNewTabHomePage( d->generalUi.rbUseNewTabPage->isChecked() ); + QTableWidget *t = d->newtabpageUi.tableWidget; QStringList names, urls; for(int i=0; i<9; ++i) diff --git a/src/settings_general.ui b/src/settings_general.ui index 6de49e64..8e62182f 100644 --- a/src/settings_general.ui +++ b/src/settings_general.ui @@ -21,7 +21,7 @@ </property> <layout class="QVBoxLayout" name="verticalLayout_2"> <item> - <widget class="QRadioButton" name="kcfg_useNewTabPage"> + <widget class="QRadioButton" name="rbUseNewTabPage"> <property name="text"> <string>Use new tab page</string> </property> @@ -33,7 +33,7 @@ <item> <layout class="QHBoxLayout" name="horizontalLayout"> <item> - <widget class="QRadioButton" name="radioButton"> + <widget class="QRadioButton" name="rbUseHomePage"> <property name="text"> <string>Use this page:</string> </property> @@ -119,13 +119,6 @@ </widget> </item> <item> - <widget class="QCheckBox" name="kcfg_externalUrlNewTab"> - <property name="text"> - <string>Open external URLs as new tab in existing window</string> - </property> - </widget> - </item> - <item> <widget class="QCheckBox" name="kcfg_alwaysShowTabBar"> <property name="text"> <string>Always show tab bar</string> diff --git a/src/websnap.cpp b/src/websnap.cpp index ec537b32..c669dee0 100644 --- a/src/websnap.cpp +++ b/src/websnap.cpp @@ -58,7 +58,6 @@ WebSnap::WebSnap(const QString &url, const QString &pos) void WebSnap::load() { - kDebug() << "loading.."; m_page.mainFrame()->load( QUrl(m_url) ); } @@ -72,17 +71,16 @@ void WebSnap::saveResult(bool ok) return; } - // find proper size, we stick to sensible aspect ratio + // find proper image size and later resize it.. QSize size = m_page.mainFrame()->contentsSize(); - size.setHeight(size.width() * HEIGHT / WIDTH ); - + // create the target surface - m_image = QPixmap(WIDTH, HEIGHT); + m_image = QPixmap( size ); m_image.fill(Qt::transparent); // render and rescale QPainter p(&m_image); - m_page.setViewportSize(m_page.mainFrame()->contentsSize()); + m_page.setViewportSize( size ); m_page.mainFrame()->render(&p); p.end(); m_image = m_image.scaled(WIDTH, HEIGHT, Qt::KeepAspectRatioByExpanding); |