diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2008-12-21 23:28:11 +0100 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2008-12-21 23:28:11 +0100 |
commit | cb8ae84a4e2b0c9fa0f1ea8b49401a64f8779fbc (patch) | |
tree | 5c28ae87be4c2ad6fc77b82e76489665768d922a | |
parent | little updates.. (diff) | |
download | rekonq-cb8ae84a4e2b0c9fa0f1ea8b49401a64f8779fbc.tar.xz |
Polishing code a bit..
-rw-r--r-- | src/browsermainwindow.cpp | 11 | ||||
-rw-r--r-- | src/tabwidget.cpp | 85 | ||||
-rw-r--r-- | src/tabwidget.h | 3 |
3 files changed, 16 insertions, 83 deletions
diff --git a/src/browsermainwindow.cpp b/src/browsermainwindow.cpp index a37037f7..9fa6b4f6 100644 --- a/src/browsermainwindow.cpp +++ b/src/browsermainwindow.cpp @@ -151,11 +151,7 @@ QByteArray BrowserMainWindow::saveState() const stream << KToolBar::toolBarsLocked(); bool b = true; // statusBar()->isVisible() ; FIXME stream << b; -// if (withTabs) -// // stream << tabWidget()->saveState(); -// ; -// else - stream << QByteArray(); + stream << QByteArray(); return data; } @@ -188,17 +184,12 @@ void BrowserMainWindow::restoreState(const QByteArray &state) stream >> size; stream >> toolbarsLocked; stream >> showStatusbar; -// stream >> tabState; resize(size); statusBar()->setVisible(showStatusbar); updateStatusbarActionText(showStatusbar); KToolBar::setToolBarsLocked ( toolbarsLocked ); -// if ( !tabWidget()->restoreState(tabState) ) -// { -// return false; -// } return; } diff --git a/src/tabwidget.cpp b/src/tabwidget.cpp index 7d0fb788..06a14ff3 100644 --- a/src/tabwidget.cpp +++ b/src/tabwidget.cpp @@ -774,69 +774,6 @@ void TabWidget::previousTab() setCurrentIndex(next); } -/* -static const qint32 TabWidgetMagic = 0xaa; - - -QByteArray TabWidget::saveState() const -{ - int version = 1; - QByteArray data; - QDataStream stream(&data, QIODevice::WriteOnly); - - stream << qint32(TabWidgetMagic); - stream << qint32(version); - - QStringList tabs; - for (int i = 0; i < count(); ++i) - { - if (WebView *tab = qobject_cast<WebView*>(widget(i))) - { - tabs.append(tab->url().prettyUrl()); - } - else - { - tabs.append(QString::null); - } - } - stream << tabs; - stream << currentIndex(); - return data; -} - - -bool TabWidget::restoreState(const QByteArray &state) -{ - int version = 1; - QByteArray sd = state; - QDataStream stream(&sd, QIODevice::ReadOnly); - if (stream.atEnd()) - return false; - - qint32 marker; - qint32 v; - stream >> marker; - stream >> v; - if (marker != TabWidgetMagic || v != version) - return false; - - QStringList openTabs; - stream >> openTabs; - - for (int i = 0; i < openTabs.count(); ++i) - { - if (i != 0) - newTab(); - loadPage(openTabs.at(i)); - } - - int currentTab; - stream >> currentTab; - setCurrentIndex(currentTab); - - return true; -}*/ - // ---------------------------------------------------------------------------------------------------------------------------- @@ -847,10 +784,13 @@ WebActionMapper::WebActionMapper(KAction *root, QWebPage::WebAction webAction, Q , m_root(root) , m_webAction(webAction) { - if (!m_root) + if ( !m_root ) + { return; - connect(m_root, SIGNAL(triggered()), this, SLOT(rootTriggered())); - connect(root, SIGNAL(destroyed(QObject *)), this, SLOT(rootDestroyed())); + } + connect(m_root, SIGNAL( triggered() ), this, SLOT( rootTriggered() ) ); + connect(root, SIGNAL( destroyed(QObject *) ), this, SLOT( rootDestroyed() ) ); + root->setEnabled(false); } @@ -869,9 +809,11 @@ void WebActionMapper::currentDestroyed() void WebActionMapper::addChild(KAction *action) { - if (!action) + if ( !action ) + { return; - connect(action, SIGNAL(changed()), this, SLOT(childChanged())); + } + connect(action, SIGNAL( changed() ), this, SLOT( childChanged() ) ); } QWebPage::WebAction WebActionMapper::webAction() const @@ -913,8 +855,11 @@ void WebActionMapper::updateCurrent(QWebPage *currentParent) m_currentParent = currentParent; if (!m_root) + { return; - if (!m_currentParent) { + } + if (!m_currentParent) + { m_root->setEnabled(false); m_root->setChecked(false); return; @@ -922,5 +867,5 @@ void WebActionMapper::updateCurrent(QWebPage *currentParent) KAction *source = new KAction( m_currentParent->action(m_webAction) ); m_root->setChecked(source->isChecked()); m_root->setEnabled(source->isEnabled()); - connect(m_currentParent, SIGNAL(destroyed(QObject *)), this, SLOT(currentDestroyed())); + connect(m_currentParent, SIGNAL( destroyed(QObject *) ), this, SLOT( currentDestroyed() ) ); } diff --git a/src/tabwidget.h b/src/tabwidget.h index d99ff156..4edba9b9 100644 --- a/src/tabwidget.h +++ b/src/tabwidget.h @@ -168,9 +168,6 @@ public: QLineEdit *lineEdit(int index) const; int webViewIndex(WebView *webView) const; -// QByteArray saveState() const; -// bool restoreState(const QByteArray &state); - protected: void mouseDoubleClickEvent(QMouseEvent *event); void contextMenuEvent(QContextMenuEvent *event); |