From 63b34dc6ccd32c9bc7c3d8c0137ff12530238bde Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Thu, 30 Oct 2008 01:50:51 +0100 Subject: reKonq initial commit. Yeah! --- src/autosaver.cpp | 90 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 src/autosaver.cpp (limited to 'src/autosaver.cpp') diff --git a/src/autosaver.cpp b/src/autosaver.cpp new file mode 100644 index 00000000..f8d088dd --- /dev/null +++ b/src/autosaver.cpp @@ -0,0 +1,90 @@ +/**************************************************************************** +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information +** to ensure GNU General Public Licensing requirements will be met: +** http://www.fsf.org/licensing/licenses/info/GPLv2.html and +** http://www.gnu.org/copyleft/gpl.html. In addition, as a special +** exception, Nokia gives you certain additional rights. These rights +** are described in the Nokia Qt GPL Exception version 1.3, included in +** the file GPL_EXCEPTION.txt in this package. +** +** Qt for Windows(R) Licensees +** As a special exception, Nokia, as the sole copyright holder for Qt +** Designer, grants users of the Qt/Eclipse Integration plug-in the +** right for the Qt/Eclipse Integration to link to functionality +** provided by Qt Designer and its related libraries. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** +****************************************************************************/ + +#include "autosaver.h" + +#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()) + m_firstChange.start(); + + if (m_firstChange.elapsed() > MAXWAIT) { + saveIfNeccessary(); + } else { + m_timer.start(AUTOSAVE_IN, this); + } +} + +void AutoSaver::timerEvent(QTimerEvent *event) +{ + if (event->timerId() == m_timer.timerId()) { + saveIfNeccessary(); + } else { + QObject::timerEvent(event); + } +} + +void AutoSaver::saveIfNeccessary() +{ + if (!m_timer.isActive()) + return; + m_timer.stop(); + m_firstChange = QTime(); + if (!QMetaObject::invokeMethod(parent(), "save", Qt::DirectConnection)) { + qWarning() << "AutoSaver: error invoking slot save() on parent"; + } +} + -- cgit v1.2.1 From 4a0acb308cfecde67af334f48a521c221c4aee1a Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Fri, 7 Nov 2008 00:17:56 +0100 Subject: Setting right license --- src/autosaver.cpp | 55 +++++++++++++++++++------------------------------------ 1 file changed, 19 insertions(+), 36 deletions(-) (limited to 'src/autosaver.cpp') diff --git a/src/autosaver.cpp b/src/autosaver.cpp index f8d088dd..4b83b65d 100644 --- a/src/autosaver.cpp +++ b/src/autosaver.cpp @@ -1,39 +1,22 @@ -/**************************************************************************** -** -** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** Commercial Usage -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Nokia. -** -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information -** to ensure GNU General Public Licensing requirements will be met: -** http://www.fsf.org/licensing/licenses/info/GPLv2.html and -** http://www.gnu.org/copyleft/gpl.html. In addition, as a special -** exception, Nokia gives you certain additional rights. These rights -** are described in the Nokia Qt GPL Exception version 1.3, included in -** the file GPL_EXCEPTION.txt in this package. -** -** Qt for Windows(R) Licensees -** As a special exception, Nokia, as the sole copyright holder for Qt -** Designer, grants users of the Qt/Eclipse Integration plug-in the -** right for the Qt/Eclipse Integration to link to functionality -** provided by Qt Designer and its related libraries. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** -****************************************************************************/ +/* ============================================================ + * + * This file is a part of the reKonq project + * + * Copyright (C) 2007-2008 Trolltech ASA. All rights reserved + * Copyright (C) 2008 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, or (at your option) any later version. + * + * 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. + * + * ============================================================ */ #include "autosaver.h" -- cgit v1.2.1 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 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/autosaver.cpp') 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()) -- cgit v1.2.1 From 19e901a0ca9630b2003dd24ccfa6da54eb70bb09 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sun, 14 Dec 2008 18:27:17 +0100 Subject: adjusted rekonq name commented out (hopefully, for now) resizeEvents and focusInEvents in urlbar & searchbar --- src/autosaver.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/autosaver.cpp') diff --git a/src/autosaver.cpp b/src/autosaver.cpp index c1164e60..965d550b 100644 --- a/src/autosaver.cpp +++ b/src/autosaver.cpp @@ -1,6 +1,6 @@ /* ============================================================  * - * This file is a part of the reKonq project + * This file is a part of the rekonq project  * * Copyright (C) 2007-2008 Trolltech ASA. All rights reserved * Copyright (C) 2008 by Andrea Diamantini -- cgit v1.2.1 From 3fcb4e226ebe126f6c3a289d34f1b6a83c1444c1 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Wed, 17 Dec 2008 02:03:21 +0100 Subject: qDebug && qWarning --> kDebug && kWarning --- src/autosaver.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/autosaver.cpp') diff --git a/src/autosaver.cpp b/src/autosaver.cpp index 965d550b..535d8a2b 100644 --- a/src/autosaver.cpp +++ b/src/autosaver.cpp @@ -18,10 +18,15 @@  *  * ============================================================ */ +// Local Includes #include "autosaver.h" +// KDE Includes +#include + +// Qt Includes #include -#include + #define AUTOSAVE_IN 1000 * 3 // seconds #define MAXWAIT 1000 * 15 // seconds @@ -36,7 +41,7 @@ AutoSaver::AutoSaver(QObject *parent) : QObject(parent) AutoSaver::~AutoSaver() { if (m_timer.isActive()) - qWarning() << "AutoSaver: still active when destroyed, changes not saved."; + kWarning() << "AutoSaver: still active when destroyed, changes not saved."; } @@ -69,8 +74,9 @@ void AutoSaver::saveIfNeccessary() return; m_timer.stop(); m_firstChange = QTime(); - if (!QMetaObject::invokeMethod(parent(), "save", Qt::DirectConnection)) { - qWarning() << "AutoSaver: error invoking slot save() on parent"; + if (!QMetaObject::invokeMethod(parent(), "save", Qt::DirectConnection)) + { + kWarning() << "AutoSaver: error invoking slot save() on parent"; } } -- cgit v1.2.1 From 39409ac6a2880ad815d6096231d0fcdcfd2547f6 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sun, 22 Mar 2009 10:21:09 +0100 Subject: Fixed Copyright intro --- src/autosaver.cpp | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) (limited to 'src/autosaver.cpp') diff --git a/src/autosaver.cpp b/src/autosaver.cpp index 535d8a2b..a2ec7be5 100644 --- a/src/autosaver.cpp +++ b/src/autosaver.cpp @@ -1,22 +1,24 @@ /* ============================================================ - * - * This file is a part of the rekonq project - * - * Copyright (C) 2007-2008 Trolltech ASA. All rights reserved - * Copyright (C) 2008 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, or (at your option) any later version. - * - * 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. - * - * ============================================================ */ +* +* This file is a part of the rekonq project +* +* Copyright (C) 2007-2008 Trolltech ASA. All rights reserved +* Copyright (C) 2008 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, or (at your option) any later version. +* +* 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. +* +* ============================================================ */ + + // Local Includes #include "autosaver.h" -- cgit v1.2.1 From a934072cf9695e46e793898102590322f43c0733 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sat, 28 Mar 2009 15:53:26 +0100 Subject: astyle. First round.. --- src/autosaver.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'src/autosaver.cpp') diff --git a/src/autosaver.cpp b/src/autosaver.cpp index a2ec7be5..b09f35e9 100644 --- a/src/autosaver.cpp +++ b/src/autosaver.cpp @@ -52,9 +52,12 @@ void AutoSaver::changeOccurred() if (m_firstChange.isNull()) m_firstChange.start(); - if (m_firstChange.elapsed() > MAXWAIT) { + if (m_firstChange.elapsed() > MAXWAIT) + { saveIfNeccessary(); - } else { + } + else + { m_timer.start(AUTOSAVE_IN, this); } } @@ -62,9 +65,12 @@ void AutoSaver::changeOccurred() void AutoSaver::timerEvent(QTimerEvent *event) { - if (event->timerId() == m_timer.timerId()) { + if (event->timerId() == m_timer.timerId()) + { saveIfNeccessary(); - } else { + } + else + { QObject::timerEvent(event); } } @@ -76,7 +82,7 @@ void AutoSaver::saveIfNeccessary() return; m_timer.stop(); m_firstChange = QTime(); - if (!QMetaObject::invokeMethod(parent(), "save", Qt::DirectConnection)) + if (!QMetaObject::invokeMethod(parent(), "save", Qt::DirectConnection)) { kWarning() << "AutoSaver: error invoking slot save() on parent"; } -- cgit v1.2.1 From 7557af13f9f904cb9a6240d2101fb14e1ffdca99 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Wed, 22 Apr 2009 01:33:28 +0200 Subject: Fixing Copyrights --- src/autosaver.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/autosaver.cpp') diff --git a/src/autosaver.cpp b/src/autosaver.cpp index b09f35e9..06df32bf 100644 --- a/src/autosaver.cpp +++ b/src/autosaver.cpp @@ -3,7 +3,8 @@ * This file is a part of the rekonq project * * Copyright (C) 2007-2008 Trolltech ASA. All rights reserved -* Copyright (C) 2008 by Andrea Diamantini +* Copyright (C) 2008-2009 by Andrea Diamantini +* Copyright (C) 2009 rekonq team. Please, see AUTHORS file for details * * * This program is free software; you can redistribute it -- cgit v1.2.1 From e657ef44ef1eef1f998101ab3dcce1a251d729fc Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sun, 26 Apr 2009 01:45:38 +0200 Subject: Fixed copyright strings, per file, as decided --- src/autosaver.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src/autosaver.cpp') diff --git a/src/autosaver.cpp b/src/autosaver.cpp index 06df32bf..25bf9016 100644 --- a/src/autosaver.cpp +++ b/src/autosaver.cpp @@ -4,7 +4,6 @@ * * Copyright (C) 2007-2008 Trolltech ASA. All rights reserved * Copyright (C) 2008-2009 by Andrea Diamantini -* Copyright (C) 2009 rekonq team. Please, see AUTHORS file for details * * * This program is free software; you can redistribute it -- cgit v1.2.1 From 06b2dc0ce6ec6dd4cb090c22e2f9f8521138146b Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Wed, 6 May 2009 03:09:23 +0200 Subject: EBN Krazy fixes. 1st round.. --- src/autosaver.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/autosaver.cpp') diff --git a/src/autosaver.cpp b/src/autosaver.cpp index 25bf9016..c7da12f3 100644 --- a/src/autosaver.cpp +++ b/src/autosaver.cpp @@ -20,14 +20,15 @@ -// Local Includes +// Self Includes #include "autosaver.h" +#include "autosaver.moc" // KDE Includes #include // Qt Includes -#include +#include #define AUTOSAVE_IN 1000 * 3 // seconds -- cgit v1.2.1