From a02a9101fe127211de1fd24f6876b87686309997 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sat, 6 Dec 2008 23:30:36 +0100 Subject: QTabWidget --> KTabWidget --- src/autosaver.cpp | 9 ++++++--- src/autosaver.h | 8 +++----- src/tabwidget.cpp | 28 ++++++++++++++++++++-------- src/tabwidget.h | 10 +++++----- 4 files changed, 34 insertions(+), 21 deletions(-) diff --git a/src/autosaver.cpp b/src/autosaver.cpp index 4b83b65d..c1164e60 100644 --- a/src/autosaver.cpp +++ b/src/autosaver.cpp @@ -20,25 +20,26 @@ #include "autosaver.h" -#include -#include -#include +#include #include #define AUTOSAVE_IN 1000 * 3 // seconds #define MAXWAIT 1000 * 15 // seconds + AutoSaver::AutoSaver(QObject *parent) : QObject(parent) { Q_ASSERT(parent); } + AutoSaver::~AutoSaver() { if (m_timer.isActive()) qWarning() << "AutoSaver: still active when destroyed, changes not saved."; } + void AutoSaver::changeOccurred() { if (m_firstChange.isNull()) @@ -51,6 +52,7 @@ void AutoSaver::changeOccurred() } } + void AutoSaver::timerEvent(QTimerEvent *event) { if (event->timerId() == m_timer.timerId()) { @@ -60,6 +62,7 @@ void AutoSaver::timerEvent(QTimerEvent *event) } } + void AutoSaver::saveIfNeccessary() { if (!m_timer.isActive()) diff --git a/src/autosaver.h b/src/autosaver.h index d8004a9d..70dca53a 100644 --- a/src/autosaver.h +++ b/src/autosaver.h @@ -21,17 +21,15 @@ #ifndef AUTOSAVER_H #define AUTOSAVER_H -#include -#include -#include +#include /* This class will call the save() slot on the parent object when the parent changes. It will wait several seconds after changed() to combining multiple changes and prevent continuous writing to disk. */ -class AutoSaver : public QObject { - +class AutoSaver : public QObject +{ Q_OBJECT public: diff --git a/src/tabwidget.cpp b/src/tabwidget.cpp index 57e80856..b8e9c748 100644 --- a/src/tabwidget.cpp +++ b/src/tabwidget.cpp @@ -57,6 +57,11 @@ TabBar::TabBar(QWidget *parent) } +TabBar::~TabBar() +{ +} + + void TabBar::selectTabAction() { if (QShortcut *shortCut = qobject_cast(sender())) @@ -199,7 +204,7 @@ void TabBar::reloadTab() TabWidget::TabWidget(QWidget *parent) - : QTabWidget(parent) + : KTabWidget(parent) , m_recentlyClosedTabsAction(0) , m_newTabAction(0) , m_closeTabAction(0) @@ -266,6 +271,11 @@ TabWidget::TabWidget(QWidget *parent) } +TabWidget::~TabWidget() +{ +} + + void TabWidget::clear() { // clear the recently closed tabs @@ -310,7 +320,6 @@ void TabWidget::reloadTab(int index) } - void TabWidget::addWebAction(KAction *action, QWebPage::WebAction webAction) { if (!action) @@ -588,8 +597,10 @@ void TabWidget::closeTab(int index) return; bool hasFocus = false; - if (WebView *tab = webView(index)) { - if (tab->isModified()) { + if (WebView *tab = webView(index)) + { + if (tab->isModified()) + { QMessageBox closeConfirmation(tab); closeConfirmation.setWindowFlags(Qt::Sheet); closeConfirmation.setWindowTitle(i18n("Do you really want to close this page?")); @@ -627,9 +638,10 @@ void TabWidget::webViewLoadStarted() { WebView *webView = qobject_cast(sender()); int index = webViewIndex(webView); - if (-1 != index) { - QIcon icon(QLatin1String(":loading.gif")); // FIXME - setTabIcon(index, icon); + if (-1 != index) + { +// QIcon icon(QLatin1String(":loading.gif")); + setTabIcon(index, KIcon("rekonq") ); } } @@ -694,7 +706,7 @@ void TabWidget::aboutToShowRecentTriggeredAction(QAction *action) void TabWidget::mouseDoubleClickEvent(QMouseEvent *event) { - if ( !childAt(event->pos()) + if ( !childAt(event->pos() ) // Remove the line below when QTabWidget does not have a one pixel frame && event->pos().y() < (tabBar()->y() + tabBar()->height())) { diff --git a/src/tabwidget.h b/src/tabwidget.h index 6e9f2f66..020376e1 100644 --- a/src/tabwidget.h +++ b/src/tabwidget.h @@ -45,6 +45,7 @@ signals: public: TabBar(QWidget *parent = 0); + ~TabBar(); protected: void mousePressEvent(QMouseEvent* event); @@ -72,7 +73,6 @@ private: // ---------------------------------------------------------------------------------------------------------------------------- - #include class WebView; @@ -112,9 +112,7 @@ private: #include #include #include - -// Qt Includes -#include +#include QT_BEGIN_NAMESPACE class QCompleter; @@ -127,7 +125,7 @@ QT_END_NAMESPACE Connects up the current tab's signals to this class's signal and uses WebActionMapper to proxy the actions. */ -class TabWidget : public QTabWidget +class TabWidget : public KTabWidget { Q_OBJECT @@ -150,6 +148,8 @@ signals: public: TabWidget(QWidget *parent = 0); + ~TabWidget(); + void clear(); void addWebAction(KAction *action, QWebPage::WebAction webAction); -- cgit v1.2.1