summaryrefslogtreecommitdiffstats
path: root/krusader/KViewer/krviewer.h
diff options
context:
space:
mode:
Diffstat (limited to 'krusader/KViewer/krviewer.h')
-rw-r--r--krusader/KViewer/krviewer.h128
1 files changed, 128 insertions, 0 deletions
diff --git a/krusader/KViewer/krviewer.h b/krusader/KViewer/krviewer.h
new file mode 100644
index 0000000..618e9a2
--- /dev/null
+++ b/krusader/KViewer/krviewer.h
@@ -0,0 +1,128 @@
+/***************************************************************************
+ krviewer.h - description
+ -------------------
+ begin : Thu Apr 18 2002
+ copyright : (C) 2002 by Shie Erlich & Rafi Yanai
+ email :
+***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef KRVIEWER_H
+#define KRVIEWER_H
+
+#include <qwidget.h>
+#include <qptrlist.h>
+#include <kparts/mainwindow.h>
+#include <ktempfile.h>
+#include <kparts/partmanager.h>
+#include <kparts/browserextension.h>
+#include <qguardedptr.h>
+#include <ktabwidget.h>
+
+#include "../krusader.h"
+
+
+/**
+ *@author Shie Erlich & Rafi Yanai
+ */
+
+class QPopupMenu;
+class PanelViewerBase;
+
+class KrViewer : public KParts::MainWindow {
+ Q_OBJECT
+public:
+ virtual ~KrViewer();
+
+ enum Mode{Generic,Text,Hex};
+
+ static void view( KURL url, QWidget * parent = krApp );
+ static void view( KURL url, Mode mode, bool new_window, QWidget * parent = krApp );
+ static void edit( KURL url, QWidget * parent );
+ static void edit( KURL url, Mode mode=Text, int new_window=-1, QWidget * parent = krApp );
+
+ virtual bool eventFilter ( QObject * watched, QEvent * e );
+
+public slots:
+ void keyPressEvent( QKeyEvent *e );
+ void createGUI( KParts::Part* );
+
+ void viewGeneric();
+ void viewText();
+ void viewHex();
+ void editText();
+
+ void print();
+ void copy();
+
+ void tabChanged(QWidget* w);
+ void tabURLChanged( PanelViewerBase * pvb, const KURL &url );
+ void tabCloseRequest(QWidget *w);
+ void tabCloseRequest();
+
+ void nextTab();
+ void prevTab();
+ void detachTab();
+
+ void checkModified();
+
+protected:
+ virtual bool queryClose();
+ virtual bool queryExit();
+ virtual void windowActivationChange ( bool oldActive );
+
+ virtual void focusInEvent( QFocusEvent * ){ if( viewers.remove( this ) ) viewers.prepend( this ); } // move to first
+
+private:
+ KrViewer( QWidget *parent = 0, const char *name = 0 );
+ void addTab(PanelViewerBase* pvb, QString msg,QString iconName, KParts::Part* part);
+ PanelViewerBase * getPanelViewerBase( KParts::Part* part);
+ void updateActions( PanelViewerBase * base );
+
+ static KrViewer* getViewer(bool new_window);
+
+ KParts::PartManager manager;
+ QPopupMenu* viewerMenu;
+ KTempFile tmpFile;
+ KTabWidget tabBar;
+ QGuardedPtr<QWidget> returnFocusTo;
+ PanelViewerBase * returnFocusTab;
+
+ int detachActionIndex;
+
+ KAction *printAction;
+ KAction *copyAction;
+
+ int tabCloseID;
+ int closeID;
+
+ static QPtrList<KrViewer> viewers; // the first viewer is the active one
+ QValueList<int> reservedKeys; // the reserved key sequences
+ QValueList<int> reservedKeyIDs; // the IDs of the reserved keys
+};
+
+class Invoker : public QObject {
+ Q_OBJECT
+
+public:
+ Invoker( QObject *recv, const char * slot ) {
+ connect( this, SIGNAL( invokeSignal() ), recv, slot );
+ }
+
+ void invoke() {
+ emit invokeSignal();
+ }
+
+signals:
+ void invokeSignal();
+};
+
+#endif