From 4aed2c8219774f5d797760606b8489a92ddc5163 Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- konqueror/keditbookmarks/bookmarkinfo.h | 111 ++++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 konqueror/keditbookmarks/bookmarkinfo.h (limited to 'konqueror/keditbookmarks/bookmarkinfo.h') diff --git a/konqueror/keditbookmarks/bookmarkinfo.h b/konqueror/keditbookmarks/bookmarkinfo.h new file mode 100644 index 000000000..51661959a --- /dev/null +++ b/konqueror/keditbookmarks/bookmarkinfo.h @@ -0,0 +1,111 @@ +// vim: set ts=4 sts=4 sw=4 et: +/* This file is part of the KDE project + Copyright (C) 2000 David Faure + Copyright (C) 2002-2003 Alexander Kellett + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License version 2 as published by the Free Software Foundation. + + 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; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef __bookmarkinfo_h +#define __bookmarkinfo_h + +#include "commands.h" + +#include +#include +#include + +class QTimer; + +class BookmarkLineEdit : public KLineEdit { + Q_OBJECT +public: + BookmarkLineEdit( QWidget * ); +public slots: + virtual void cut (); +}; + + +class BookmarkInfoWidget : public QWidget { + Q_OBJECT +public: + BookmarkInfoWidget(QWidget * = 0, const char * = 0); + void showBookmark(const KBookmark &bk); + void saveBookmark(const KBookmark &bk); + KBookmark bookmark() { return m_bk; } + bool connected() { return m_connected; }; + void setConnected(bool b) { m_connected = b; }; + void updateStatus(); + +public slots: + void slotTextChangedURL(const QString &); + void slotTextChangedTitle(const QString &); + void slotTextChangedComment(const QString &); + + // _The deal with all those commitChanges() calls_ + // First a short example how all the components + // normally fit together: + // Note: not all details are included + // For example: The user clicks on "New Bookmark" + // This constructs a cmd = new CreateCommand( .. ) + // CmdHistory::self()->addCommand( cmd ) is called + // CmdHistory executes the command + // and enables the undo button + // and emits slotCommandExecuted + // We catch the signal and call + // CurrentMgr::self()->notifyManagers( .. ); + + // The bookmarkinfo widget is special, because + // we don't want to send a notification + // for every change, but want to enable the undo + // button and need to send the notification + // if the user has stopped typing + + // So as soon as the user starts typing + // we create a command + // and call CmdHistory::self()->addInFlightCommand( cmd ); + // addInFlightCommand() doesn't execute the command, it just + // adds it to the command history (To enable the undo button) + // For every keystroke after that the command is modified + // and we change our internal state to reflect the change + // (Basically changing it in the same way, executing would have.) + + // At this point we have a modified state, but haven't send it + // to the other bookmarkmanagers + // That is done in commitChanges() + // commitChanges() should be called everywhere, where we are + // sure that the user has stopped typing. + // And a few other cleanups are done in commitChanges() + void commitChanges(); + void commitTitle(); + void commitURL(); + void commitComment(); + +signals: + void updateListViewItem(); +private: + NodeEditCommand *titlecmd; + EditCommand *urlcmd; + NodeEditCommand *commentcmd; + QTimer * timer; + BookmarkLineEdit *m_title_le, *m_url_le, + *m_comment_le; + KLineEdit *m_visitdate_le, *m_credate_le, + *m_visitcount_le; + KBookmark m_bk; + bool m_connected; +}; + +#endif -- cgit v1.2.1