kio Library API Documentation

kbookmarkmenu_p.h

00001 //  -*- c-basic-offset:4; indent-tabs-mode:nil -*-
00002 // vim: set ts=4 sts=4 sw=4 et:
00003 /* This file is part of the KDE project
00004    Copyright (C) 2003 Alexander Kellett <lypanov@kde.org>
00005 
00006    This library is free software; you can redistribute it and/or
00007    modify it under the terms of the GNU Library General Public
00008    License as published by the Free Software Foundation; either
00009    version 2 of the License, or (at your option) any later version.
00010 
00011    This library is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014    Library General Public License for more details.
00015 
00016    You should have received a copy of the GNU Library General Public License
00017    along with this library; see the file COPYING.LIB.  If not, write to
00018    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00019    Boston, MA 02111-1307, USA.
00020 */
00021 
00022 #ifndef __kbookmarkmenu_p_h__
00023 #define __kbookmarkmenu_p_h__
00024 
00025 #include <sys/types.h>
00026 
00027 #include <qptrlist.h>
00028 #include <qptrstack.h>
00029 #include <qobject.h>
00030 #include <qlistview.h>
00031 
00032 #include <kdialogbase.h>
00033 #include <klocale.h>
00034 #include <kaction.h>
00035 
00036 #include "kbookmark.h"
00037 #include "kbookmarkimporter.h"
00038 #include "kbookmarkmanager.h"
00039 
00040 class QString;
00041 class QPopupMenu;
00042 class QPushButton;
00043 class QListView;
00044 class KLineEdit;
00045 class KBookmark;
00046 class KBookmarkGroup;
00047 class KAction;
00048 class KActionMenu;
00049 class KActionCollection;
00050 class KBookmarkOwner;
00051 class KBookmarkMenu;
00052 class KBookmarkBar;
00053 class KPopupMenu;
00054 
00055 class KImportedBookmarksActionMenu : public KActionMenu {
00056   Q_OBJECT
00057   Q_PROPERTY( QString type READ type WRITE setType )
00058   Q_PROPERTY( QString location READ location WRITE setLocation )
00059 public:
00060   const QString type() const { return m_type; }
00061   void setType(const QString &type) { m_type = type; }
00062   const QString location() const { return m_location; }
00063   void setLocation(const QString &location) { m_location = location; }
00064 private:
00065   QString m_type;
00066   QString m_location;
00067 public:
00068   KImportedBookmarksActionMenu( 
00069     const QString &text, const QString& sIconName,
00070     KActionCollection* parent, const char* name)
00071   : KActionMenu(text, sIconName, parent, name) {
00072      ;
00073   }
00074 };
00075 
00076 class KBookmarkActionMenu : public KActionMenu {
00077   Q_OBJECT
00078   Q_PROPERTY( QString url READ url WRITE setUrl )
00079   Q_PROPERTY( QString address READ address WRITE setAddress )
00080   Q_PROPERTY( bool readOnly READ readOnly WRITE setReadOnly )
00081 public:
00082   const QString url() const { return m_url; }
00083   void setUrl(const QString &url) { m_url = url; }
00084   const QString address() const { return m_address; }
00085   void setAddress(const QString &address) { m_address = address; }
00086   bool readOnly() const { return m_readOnly; }
00087   void setReadOnly(bool readOnly) { m_readOnly = readOnly; }
00088 private:
00089   QString m_url;
00090   QString m_address;
00091   bool m_readOnly;
00092 public:
00093   KBookmarkActionMenu( 
00094     const QString &text, const QString& sIconName,
00095     KActionCollection* parent, const char* name)
00096   : KActionMenu(text, sIconName, parent, name) {
00097      ;
00098   }
00099 };
00100 
00101 class KBookmarkAction : public KAction {
00102   Q_OBJECT
00103   Q_PROPERTY( QString url READ url WRITE setUrl )
00104   Q_PROPERTY( QString address READ address WRITE setAddress )
00105 public:
00106   const QString url() const { return m_url; }
00107   void setUrl(const QString &url) { m_url = url; }
00108   const QString address() const { return m_address; }
00109   void setAddress(const QString &address) { m_address = address; }
00110 private:
00111   QString m_url;
00112   QString m_address;
00113 public:
00114   KBookmarkAction(
00115     const QString& text, const QString& sIconName, const KShortcut& cut,
00116     const QObject* receiver, const char* slot,
00117     KActionCollection* parent, const char* name)
00118   : KAction(text, sIconName, cut, receiver, slot, parent, name) {
00119     ;
00120   }
00121 };
00122 
00123 class KBookmarkEditFields {
00124 public:
00125   typedef enum { FolderFieldsSet, BookmarkFieldsSet } FieldsSet;
00126   KLineEdit * m_url;
00127   KLineEdit * m_title;
00128   KBookmarkEditFields(QWidget *main, QBoxLayout *vbox, FieldsSet isFolder);
00129   void setName(const QString &str);
00130   void setLocation(const QString &str);
00131 };
00132 
00133 class KBookmarkEditDialog : public KDialogBase
00134 {
00135   Q_OBJECT
00136 
00137 public:
00138   typedef enum { ModifyMode, InsertionMode } BookmarkEditType;
00139 
00140   KBookmarkEditDialog( const QString& title, const QString& url, KBookmarkManager *, BookmarkEditType editType,
00141                        QWidget * = 0, const char * = 0, const QString& caption = i18n( "Add Bookmark" ) );
00142 
00143   QString finalUrl() const;
00144   QString finalTitle() const;
00145   QString finalAddress() const;
00146 
00147 protected slots:
00148   void slotOk();
00149   void slotCancel();
00150   void slotUser1();
00151   void slotDoubleClicked(QListViewItem* item);
00152 
00153 private:
00154   QWidget * m_main;
00155   KBookmarkEditFields * m_fields;
00156   QListView * m_folderTree;
00157   QPushButton * m_button;
00158   KBookmarkManager * m_mgr;
00159   BookmarkEditType m_editType;
00160 };
00161 
00162 class KBookmarkFolderTreeItem : public QListViewItem
00163 {
00164   // make this an accessor
00165   friend class KBookmarkFolderTree;
00166 public:
00167   KBookmarkFolderTreeItem( QListView *, const KBookmark & );
00168   KBookmarkFolderTreeItem( KBookmarkFolderTreeItem *, QListViewItem *, const KBookmarkGroup & );
00169 private:
00170   KBookmark m_bookmark;
00171 };
00172 
00173 class KBookmarkFolderTree
00174 {
00175 public:
00176   static QListView* createTree( KBookmarkManager *, QWidget * = 0, const char * = 0 );
00177   static void fillTree( QListView*, KBookmarkManager * );
00178   static QString selectedAddress( QListView* );
00179   static void setAddress( QListView *, const QString & );
00180 };
00181 
00182 class KBookmarkSettings 
00183 {
00184 public:
00185   bool m_advancedaddbookmark;
00186   bool m_contextmenu;
00187   bool m_quickactions;
00188   bool m_filteredtoolbar;
00189   static KBookmarkSettings *s_self;
00190   static void readSettings();
00191   static KBookmarkSettings *self();
00192 };
00193 
00194 class RMB
00195 {
00196 public:
00197   static void begin_rmb_action(KBookmarkMenu *);
00198   static void begin_rmb_action(KBookmarkBar *);
00199   bool invalid( int val );
00200   KBookmark atAddress(const QString & address);
00201   void fillContextMenu( QPopupMenu* contextMenu, const QString & address, int val );
00202   void fillContextMenu2( QPopupMenu* contextMenu, const QString & address, int val );
00203   void slotRMBActionEditAt( int val );
00204   void slotRMBActionProperties( int val );
00205   void slotRMBActionInsert( int val );
00206   void slotRMBActionRemove( int val );
00207   void slotRMBActionCopyLocation( int val );
00208   void hidePopup();
00209 public:
00210   QObject *recv;
00211   KBookmarkManager *m_pManager;
00212   QString s_highlightedAddress;
00213   QString m_parentAddress;
00214   KBookmarkOwner *m_pOwner;
00215   QWidget *m_parentMenu;
00216 };
00217 
00218 #endif
KDE Logo
This file is part of the documentation for kio Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed May 5 07:16:44 2004 by doxygen 1.3.6 written by Dimitri van Heesch, © 1997-2003