From 44505a48200f16cc3c299d69383b017dba9ce1a9 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Tue, 16 Oct 2012 18:03:28 +0200 Subject: Re-enable the restore on crash message bar :) --- src/CMakeLists.txt | 2 +- src/application.cpp | 11 +------ src/webtab/crashmessagebar.cpp | 71 ++++++++++++++++++++++++++++++++++++++++++ src/webtab/crashmessagebar.h | 54 ++++++++++++++++++++++++++++++++ src/webtab/messagebar.cpp | 71 ------------------------------------------ src/webtab/messagebar.h | 54 -------------------------------- src/webtab/webtab.cpp | 6 ++-- src/webtab/webtab.h | 3 +- src/webwindow/webwindow.cpp | 6 ++++ src/webwindow/webwindow.h | 2 ++ 10 files changed, 140 insertions(+), 140 deletions(-) create mode 100644 src/webtab/crashmessagebar.cpp create mode 100644 src/webtab/crashmessagebar.h delete mode 100644 src/webtab/messagebar.cpp delete mode 100644 src/webtab/messagebar.h (limited to 'src') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b8dd0c06..3ba7c641 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -86,7 +86,7 @@ set(rekonq_KDEINIT_SRCS useragent/useragentwidget.cpp #---------------------------------------- webtab/clicktoflash.cpp - webtab/messagebar.cpp + webtab/crashmessagebar.cpp webtab/networkaccessmanager.cpp webtab/previewselectorbar.cpp webtab/protocolhandler.cpp diff --git a/src/application.cpp b/src/application.cpp index 1ac66188..bd48a748 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -63,15 +63,6 @@ #include #include -// #include -// #include -// #include - -// #include -// #include -// #include -// #include -// // Qt Includes #include @@ -243,7 +234,7 @@ int Application::newInstance() { if (hasToBeRecoveredFromCrash) { - QTimer::singleShot(1000, tabWindow()->currentWebWindow(), SLOT(showMessageBar())); + QTimer::singleShot(1000, tabWindow()->currentWebWindow(), SLOT(showCrashMessageBar())); } else { diff --git a/src/webtab/crashmessagebar.cpp b/src/webtab/crashmessagebar.cpp new file mode 100644 index 00000000..11eefa41 --- /dev/null +++ b/src/webtab/crashmessagebar.cpp @@ -0,0 +1,71 @@ +/* ============================================================ +* +* This file is a part of the rekonq project +* +* Copyright (C) 2010-2011 by Pierre Rossi +* Copyright (C) 2011-2012 by Andrea Diamantini +* +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License or (at your option) version 3 or any later version +* accepted by the membership of KDE e.V. (or its successor approved +* by the membership of KDE e.V.), which shall act as a proxy +* defined in Section 14 of version 3 of the license. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +* +* ============================================================ */ + + +// Self Includes +#include "crashmessagebar.h" +#include "crashmessagebar.moc" + +// KDE Includes +#include +#include +#include + +// Qt Includes +#include + + +CrashMessageBar::CrashMessageBar(const QString &message, QWidget *parent) + : KMessageWidget(parent) +{ + connect(this, SIGNAL(accepted()), this, SLOT(hideAndDelete())); + connect(this, SIGNAL(rejected()), this, SLOT(hideAndDelete())); + + setMessageType(KMessageWidget::Warning); + + QSize sz = size(); + sz.setWidth(qobject_cast(parent)->size().width()); + resize(sz); + + setCloseButtonVisible(false); + + setText(message); + + QAction *acceptAction = new QAction(i18n("Yes"), this); + connect(acceptAction, SIGNAL(triggered(bool)), this, SIGNAL(accepted())); + addAction(acceptAction); + + QAction *rejectAction = new QAction(i18n("No"), this); + connect(rejectAction, SIGNAL(triggered(bool)), this, SIGNAL(rejected())); + addAction(rejectAction); +} + + +void CrashMessageBar::hideAndDelete() +{ + animatedHide(); + deleteLater(); +} diff --git a/src/webtab/crashmessagebar.h b/src/webtab/crashmessagebar.h new file mode 100644 index 00000000..3bbc12ab --- /dev/null +++ b/src/webtab/crashmessagebar.h @@ -0,0 +1,54 @@ +/* ============================================================ +* +* This file is a part of the rekonq project +* +* Copyright (C) 2010-2011 by Pierre Rossi +* Copyright (C) 2011-2012 by Andrea Diamantini +* +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License or (at your option) version 3 or any later version +* accepted by the membership of KDE e.V. (or its successor approved +* by the membership of KDE e.V.), which shall act as a proxy +* defined in Section 14 of version 3 of the license. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +* +* ============================================================ */ + + +#ifndef CRASH_MESSAGE_BAR_H +#define CRASH_MESSAGE_BAR_H + +// Rekonq Includes +#include "rekonq_defines.h" + +// KDE Includes +#include + + +class REKONQ_TESTS_EXPORT CrashMessageBar : public KMessageWidget +{ + Q_OBJECT + +public: + explicit CrashMessageBar(const QString & message, QWidget *parent); + +private Q_SLOTS: + void hideAndDelete(); + +Q_SIGNALS: + void accepted(); + void rejected(); +}; + + +#endif // CRASH_MESSAGE_BAR_H diff --git a/src/webtab/messagebar.cpp b/src/webtab/messagebar.cpp deleted file mode 100644 index 0e89ac56..00000000 --- a/src/webtab/messagebar.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* ============================================================ -* -* This file is a part of the rekonq project -* -* Copyright (C) 2010-2011 by Pierre Rossi -* Copyright (C) 2011 by Andrea Diamantini -* -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License as -* published by the Free Software Foundation; either version 2 of -* the License or (at your option) version 3 or any later version -* accepted by the membership of KDE e.V. (or its successor approved -* by the membership of KDE e.V.), which shall act as a proxy -* defined in Section 14 of version 3 of the license. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -* -* ============================================================ */ - - -// Self Includes -#include "messagebar.h" -#include "messagebar.moc" - -// KDE Includes -#include -#include -#include - -// Qt Includes -#include - - -MessageBar::MessageBar(const QString &message, QWidget *parent) - : KMessageWidget(parent) -{ - connect(this, SIGNAL(accepted()), this, SLOT(hideAndDelete())); - connect(this, SIGNAL(rejected()), this, SLOT(hideAndDelete())); - - setMessageType(KMessageWidget::Warning); - - QSize sz = size(); - sz.setWidth(qobject_cast(parent)->size().width()); - resize(sz); - - setCloseButtonVisible(false); - - setText(message); - - QAction *acceptAction = new QAction(i18n("Yes"), this); - connect(acceptAction, SIGNAL(triggered(bool)), this, SIGNAL(accepted())); - addAction(acceptAction); - - QAction *rejectAction = new QAction(i18n("No"), this); - connect(rejectAction, SIGNAL(triggered(bool)), this, SIGNAL(rejected())); - addAction(rejectAction); -} - - -void MessageBar::hideAndDelete() -{ - animatedHide(); - deleteLater(); -} diff --git a/src/webtab/messagebar.h b/src/webtab/messagebar.h deleted file mode 100644 index bbf5d5d4..00000000 --- a/src/webtab/messagebar.h +++ /dev/null @@ -1,54 +0,0 @@ -/* ============================================================ -* -* This file is a part of the rekonq project -* -* Copyright (C) 2010-2011 by Pierre Rossi -* Copyright (C) 2011 by Andrea Diamantini -* -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License as -* published by the Free Software Foundation; either version 2 of -* the License or (at your option) version 3 or any later version -* accepted by the membership of KDE e.V. (or its successor approved -* by the membership of KDE e.V.), which shall act as a proxy -* defined in Section 14 of version 3 of the license. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -* -* ============================================================ */ - - -#ifndef MESSAGEBAR_H -#define MESSAGEBAR_H - -// Rekonq Includes -#include "rekonq_defines.h" - -// KDE Includes -#include - - -class REKONQ_TESTS_EXPORT MessageBar : public KMessageWidget -{ - Q_OBJECT - -public: - explicit MessageBar(const QString & message, QWidget *parent); - -private Q_SLOTS: - void hideAndDelete(); - -Q_SIGNALS: - void accepted(); - void rejected(); -}; - - -#endif // MESSAGEBAR_H diff --git a/src/webtab/webtab.cpp b/src/webtab/webtab.cpp index 1a4c0fe2..549fa285 100644 --- a/src/webtab/webtab.cpp +++ b/src/webtab/webtab.cpp @@ -37,7 +37,7 @@ #include "sessionmanager.h" #include "syncmanager.h" -#include "messagebar.h" +#include "crashmessagebar.h" #include "previewselectorbar.h" #include "searchenginebar.h" #include "walletbar.h" @@ -279,9 +279,9 @@ void WebTab::setPart(KParts::ReadOnlyPart *p, const KUrl &u) } -void WebTab::showMessageBar() +void WebTab::showCrashMessageBar() { - MessageBar *msgBar = new MessageBar(i18n("It seems rekonq was not closed properly. Do you want " + CrashMessageBar *msgBar = new CrashMessageBar(i18n("It seems rekonq was not closed properly. Do you want " "to restore the last saved session?"), this); qobject_cast(layout())->insertWidget(0, msgBar); diff --git a/src/webtab/webtab.h b/src/webtab/webtab.h index a0e6890d..2773dc12 100644 --- a/src/webtab/webtab.h +++ b/src/webtab/webtab.h @@ -75,6 +75,8 @@ public: void createPreviewSelectorBar(int index); void hideSelectorBar(); + void showCrashMessageBar(); + bool isPageLoading(); KParts::ReadOnlyPart *part(); @@ -86,7 +88,6 @@ private Q_SLOTS: void createWalletBar(const QString &, const QUrl &); - void showMessageBar(); void loadFinished(); void showSearchEngineBar(); diff --git a/src/webwindow/webwindow.cpp b/src/webwindow/webwindow.cpp index f7adb1b6..0c635800 100644 --- a/src/webwindow/webwindow.cpp +++ b/src/webwindow/webwindow.cpp @@ -866,3 +866,9 @@ void WebWindow::setPrivateBrowsing(bool on) _tab->page()->settings()->setAttribute(QWebSettings::PrivateBrowsingEnabled, on); _isPrivateBrowsing = on; } + + +void WebWindow::showCrashMessageBar() +{ + _tab->showCrashMessageBar(); +} diff --git a/src/webwindow/webwindow.h b/src/webwindow/webwindow.h index a333f310..b39df0ab 100644 --- a/src/webwindow/webwindow.h +++ b/src/webwindow/webwindow.h @@ -97,6 +97,8 @@ private Q_SLOTS: void webLoadStarted(); void webLoadFinished(bool); + void showCrashMessageBar(); + void urlbarFocused(); // history related -- cgit v1.2.1