KDevelop API Documentation

bookmarks_part.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2003 by Jens Dagerbo                                    *
00003  *   jens.dagerbo@swipnet.se                                               *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  ***************************************************************************/
00011 
00012 
00013 #ifndef __KDEVPART_BOOKMARKS_H__
00014 #define __KDEVPART_BOOKMARKS_H__
00015 
00016 
00017 #include <qguardedptr.h>
00018 #include <qvaluelist.h>
00019 #include <qdict.h>
00020 #include <qpair.h>
00021 
00022 #include <kparts/part.h>
00023 #include <kurl.h>
00024 
00025 #include <kdevplugin.h>
00026 
00027 class QTimer;
00028 class KDialogBase;
00029 class BookmarksConfig;
00030 class ConfigWidgetProxy;
00031 
00032 struct EditorData
00033 {
00034     KURL url;
00035     QValueList< QPair<int,QString> > marks;
00036 };
00037 
00038 class BookmarksWidget;
00039 class QDomElement;
00040 
00041 class BookmarksPart : public KDevPlugin
00042 {
00043     Q_OBJECT
00044 
00045 public:
00046 
00047     BookmarksPart(QObject *parent, const char *name, const QStringList &);
00048     ~BookmarksPart();
00049 
00050     // reimplemented from KDevPlugin
00051     void restorePartialProjectSession( const QDomElement * el );
00052     void savePartialProjectSession( QDomElement * el );
00053     
00054     BookmarksConfig * config();
00055 
00056     QStringList getContext( KURL const & url, unsigned int line, unsigned int context );
00057     
00058 private slots:
00059     // connected to partcontroller
00060     void partAdded( KParts::Part * part );
00061 
00062     // connected to KTextEditor::MarkInterface
00063     void marksEvent();
00064 
00065     // connected to _marksChangeTimer   
00066     void marksChanged();
00067     
00068     // connected to KParts::ReadOnlyPart
00069     void reload();
00070 
00071     // connected to BookmarksWidget
00072     void removeAllBookmarksForURL( const KURL & );
00073     void removeBookmarkForURL( const KURL &, int );
00074 
00075     void insertConfigWidget( const KDialogBase * dlg, QWidget * page, unsigned int );
00076     
00077 private:
00078     bool setBookmarksForURL( KParts::ReadOnlyPart * );
00079     bool clearBookmarksForURL( KParts::ReadOnlyPart * );
00080     void setBookmarksForAllURLs();
00081 
00082     EditorData * storeBookmarksForURL( KParts::ReadOnlyPart * );
00083     void storeBookmarksForAllURLs();
00084 
00085     void updateContextStringForURL( KParts::ReadOnlyPart * );
00086     void updateContextStringForURL( KURL const & url );
00087     void updateContextStringForAll();
00088 
00089     QStringList getContextFromStream( QTextStream & istream, unsigned int line, unsigned int context );
00090     
00091     KParts::ReadOnlyPart * partForURL( KURL const & url );
00092     bool partIsSane( KParts::ReadOnlyPart * );
00093 
00094     QGuardedPtr<BookmarksWidget> _widget;
00095     QDict<EditorData> _editorMap;
00096     bool _settingMarks; //  are we currently in the process of setting bookmarks?
00097     
00098     BookmarksConfig * _config;
00099     
00100     ConfigWidgetProxy * _configProxy;
00101     
00102     QTimer * _marksChangeTimer;
00103     QValueList<KParts::ReadOnlyPart*> _dirtyParts;
00104 };
00105 
00106 
00107 #endif
00108 
00109 // kate: space-indent off; indent-width 4; tab-width 4; show-tabs off;
KDE Logo
This file is part of the documentation for KDevelop Version 3.1.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Mar 23 00:03:54 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003