src/partcontroller.h
Go to the documentation of this file.00001
#ifndef __PARTCONTROLLER_H__
00002
#define __PARTCONTROLLER_H__
00003
00004
#include "kdevpartcontroller.h"
00005
00006
#include <qwidget.h>
00007
#include <qdatetime.h>
00008
#include <qptrlist.h>
00009
#include <kurl.h>
00010
#include <qmap.h>
00011
00012
namespace KParts
00013 {
00014
class Part;
00015
class Factory;
00016
class PartManager;
00017
class ReadOnlyPart;
00018 }
00019
00020
class QTabWidget;
00021
class QPopupMenu;
00022
class KAction;
00023
class KToolBarPopupAction;
00024
class KRecentFilesAction;
00025
class DocumentationPart;
00026
class HistoryEntry;
00027
class KDirWatch;
00028
00029 class PartController :
public KDevPartController
00030 {
00031 Q_OBJECT
00032
00033
public:
00034
00035
PartController(
QWidget *toplevel);
00036
00037
void setEncoding(
const QString &encoding);
00038
void editDocument(
const KURL &inputUrl,
int lineNum=-1,
int col=-1);
00039
void showDocument(
const KURL &url,
const QString &context = QString::null);
00040
KParts::Part*
findOpenDocument(
const KURL& url);
00041
00042
bool closeAllWindows();
00043
virtual bool closePartForWidget(
const QWidget* widget );
00044
00045
static void createInstance(
QWidget *parent);
00046
static PartController *
getInstance();
00047
00048
void saveAllFiles();
00049
void revertAllFiles();
00050
bool isDirty(
KParts::ReadOnlyPart* part);
00051
00052
bool readyToClose();
00053
00054
KParts::Part *
partForURL(
const KURL &url);
00055
00056
void reinstallPopups();
00057
00058
void showPart(
KParts::Part* part,
const QString& name,
const QString& shortDescription );
00059
00060
void savePartWidgetIcon(
KParts::Part *part);
00061
void restorePartWidgetIcon(
KParts::Part *part);
00062
00063
public slots:
00064
00065
void slotCurrentChanged(
QWidget *w);
00066
void slotClosePartForWidget(
const QWidget *widget);
00067
void slotActivePartChanged(
KParts::Part* part );
00068
void slotCloseAllWindows();
00069
00070 signals:
00071
void partURLChanged(
KParts::ReadOnlyPart * );
00072
00073
protected:
00074
00075
~PartController();
00076
00077
00078
private slots:
00079
00080
void slotSaveAllFiles();
00081
void slotRevertAllFiles();
00082
00083
void slotOpenFile();
00084
void slotOpenRecent(
const KURL&);
00085
00086
void slotCloseWindow();
00087
void slotCloseOtherWindows();
00088
00089
void slotBack();
00090
void slotForward();
00091
void slotBackAboutToShow();
00092
void slotBackPopupActivated(
int id );
00093
void slotForwardAboutToShow();
00094
void slotForwardPopupActivated(
int id );
00095
00096
void slotSwitchTo();
00097
00098
void slotUploadFinished();
00099
void slotFileNameChanged();
00100
00101
void updateMenuItems();
00102
void saveState(
KParts::Part* part );
00103
void restoreState();
00104
void addHistoryEntry(
HistoryEntry* entry );
00105
00106
void dirty(
const QString& fileName );
00107
void slotFileDirty(
const KURL & url );
00108
void slotNewStatus();
00109
void slotRestoreStatus();
00110
00111
private:
00112
KURL findURLInProject(
const KURL& url);
00113
00114
void setupActions();
00115
00116
bool closeWindows(
KURL::List const & ignoreList );
00117
00118
void closeActivePart();
00119
bool closePart(
KParts::Part *part);
00120
00121
QPopupMenu *
contextPopupMenu();
00122
00123
KParts::Factory *
findPartFactory(
const QString &mimeType,
const QString &partType,
const QString &preferredName = QString::null );
00124
00125
void integratePart(
KParts::Part *part,
const KURL &url,
bool isTextEditor=
false );
00126
00127
void activatePart(
KParts::Part *part);
00128
00129
void editText(
const KURL &url,
int num);
00130
00131
00132
KURL::List modifiedDocuments();
00133
void clearModified(
KURL::List const & filelist );
00134
void saveFiles(
KURL::List const & filelist );
00135
00136
void revertFile(
KParts::Part *part);
00137
void saveFile(
KParts::Part *part);
00138
00139
static PartController *
s_instance;
00140
00141 KAction *
m_closeWindowAction, *
m_saveAllFilesAction, *
m_revertAllFilesAction;
00142 KAction *
m_closeAllWindowsAction, *
m_closeOtherWindowsAction, *
m_switchToAction;
00143 KRecentFilesAction *
m_openRecentAction;
00144 QString m_presetEncoding;
00145
00146
DocumentationPart *
findDocPart(
const QString &context);
00147
00148 KToolBarPopupAction*
m_backAction;
00149 KToolBarPopupAction*
m_forwardAction;
00150 QPtrList< HistoryEntry > m_history;
00151 KDirWatch*
dirWatcher;
00152 QMap< const KParts::ReadOnlyPart*, QDateTime > accessTimeMap;
00153 QMap< const KParts::Part*, QPixmap > partWidgetIcons;
00154 bool m_restoring;
00155 };
00156
00157
00158
00159
#endif
This file is part of the documentation for KDevelop Version 3.0.4.