~ubuntu-branches/ubuntu/karmic/python-kde3/karmic

« back to all changes in this revision

Viewing changes to extra/kde352/konsole_part.h

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2006-11-22 19:03:34 UTC
  • mfrom: (1.1.5 upstream) (3.1.1 etch)
  • Revision ID: james.westby@ubuntu.com-20061122190334-z7nhzu4dca926iam
Tags: 3.16.0-0ubuntu1
* New upstream release
* Build-depend on pyqt 3.17 and sip 4.5
* Add build-depends on /usr/lib/kde3/libkonsolepart.so
* Don't build for python 2.5, it fails to build
* Merge with Debian, remaining change:
  - kubuntu_01_dcop.diff patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- C++ -*-
 
2
    This file is part of the KDE system
 
3
    Copyright (C)  1999,2000 Boloni Laszlo
 
4
 
 
5
    This program is free software; you can redistribute it and/or
 
6
    modify it under the terms of the GNU Library General Public
 
7
    License as published by the Free Software Foundation; either
 
8
    version 2 of the License, or (at your option) any later version.
 
9
 
 
10
    This program is distributed in the hope that it will be useful,
 
11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
13
    Library General Public License for more details.
 
14
 
 
15
    You should have received a copy of the GNU Library General Public License
 
16
    along with this library; see the file COPYING.LIB.  If not, write to
 
17
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 
18
    Boston, MA 02110-1301, USA.
 
19
 */
 
20
 
 
21
#ifndef KONSOLE_PART_H
 
22
#define KONSOLE_PART_H
 
23
 
 
24
#include <kparts/browserextension.h>
 
25
#include <kparts/factory.h>
 
26
 
 
27
 
 
28
#include <kdialogbase.h>
 
29
 
 
30
#include <kde_terminal_interface.h>
 
31
 
 
32
//#include "schema.h"
 
33
//#include "session.h"
 
34
 
 
35
class KInstance;
 
36
class konsoleBrowserExtension;
 
37
class QPushButton;
 
38
class QSpinBox;
 
39
class KPopupMenu;
 
40
class KActionMenu;
 
41
class QCheckBox;
 
42
class KRootPixmap;
 
43
class KToggleAction;
 
44
class KSelectAction;
 
45
 
 
46
namespace KParts { class GUIActivateEvent; }
 
47
 
 
48
class konsoleFactory : public KParts::Factory
 
49
{
 
50
    Q_OBJECT
 
51
public:
 
52
    konsoleFactory();
 
53
    virtual ~konsoleFactory();
 
54
 
 
55
    virtual KParts::Part* createPartObject(QWidget *parentWidget = 0, const char *widgetName = 0,
 
56
                                     QObject* parent = 0, const char* name = 0,
 
57
                                     const char* classname = "KParts::Part",
 
58
                                     const QStringList &args = QStringList());
 
59
 
 
60
    static KInstance *instance();
 
61
 
 
62
 private:
 
63
    static KInstance *s_instance;
 
64
    static KAboutData *s_aboutData;
 
65
};
 
66
 
 
67
//////////////////////////////////////////////////////////////////////
 
68
 
 
69
class konsolePart: public KParts::ReadOnlyPart, public TerminalInterface, public ExtTerminalInterface
 
70
{
 
71
    Q_OBJECT
 
72
        public:
 
73
    konsolePart(QWidget *parentWidget, const char *widgetName, QObject * parent, const char *name, const char *classname = 0);
 
74
    virtual ~konsolePart();
 
75
 
 
76
signals:
 
77
    void processExited( KProcess * );
 
78
    void receivedData( const QString& s );
 
79
    void forkedChild();
 
80
 protected:
 
81
    virtual bool openURL( const KURL & url );
 
82
    virtual bool openFile() {return false;} // never used
 
83
    virtual bool closeURL() {return true;}
 
84
    virtual void guiActivateEvent( KParts::GUIActivateEvent * event );
 
85
 
 
86
 protected slots:
 
87
    void showShell();
 
88
 
 
89
//    void doneSession(TESession*);
 
90
    void sessionDestroyed();
 
91
//    void configureRequest(TEWidget*,int,int x,int y);
 
92
//    void updateTitle(TESession*);
 
93
    void enableMasterModeConnections();
 
94
 
 
95
 private slots:
 
96
    void emitOpenURLRequest(const QString &url);
 
97
 
 
98
    void readProperties();
 
99
    void saveProperties();
 
100
    void applyProperties();
 
101
    void setSettingsMenuEnabled( bool );
 
102
 
 
103
    void sendSignal(int n);
 
104
    void closeCurrentSession();
 
105
 
 
106
    void notifySize(int /*columns*/, int /*lines*/);
 
107
 
 
108
    void slotToggleFrame();
 
109
    void slotSelectScrollbar();
 
110
    void slotSelectFont();
 
111
    void schema_menu_check();
 
112
    void keytab_menu_activated(int item);
 
113
    void updateSchemaMenu();
 
114
    void setSchema(int n);
 
115
    void pixmap_menu_activated(int item);
 
116
    void schema_menu_activated(int item);
 
117
    void slotHistoryType();
 
118
    void slotSelectBell();
 
119
    void slotSelectLineSpacing();
 
120
    void slotBlinkingCursor();
 
121
    void slotUseKonsoleSettings();
 
122
    void slotWordSeps();
 
123
    void slotSetEncoding();
 
124
    void biggerFont();
 
125
    void smallerFont();
 
126
 
 
127
    void autoShowShell();
 
128
 
 
129
 private:
 
130
    konsoleBrowserExtension *m_extension;
 
131
    KURL currentURL;
 
132
 
 
133
    void makeGUI();
 
134
    void applySettingsToGUI();
 
135
 
 
136
//    void setSchema(ColorSchema* s);
 
137
    void updateKeytabMenu();
 
138
 
 
139
        bool doOpenStream( const QString& );
 
140
        bool doWriteStream( const QByteArray& );
 
141
        bool doCloseStream();
 
142
 
 
143
    QWidget* parentWidget;
 
144
//    TEWidget* te;
 
145
//    TESession* se;
 
146
 //   ColorSchemaList* colors;
 
147
    KRootPixmap* rootxpm;
 
148
 
 
149
    KActionCollection* actions;
 
150
    KActionCollection* settingsActions;
 
151
 
 
152
    KToggleAction* blinkingCursor;
 
153
    KToggleAction* showFrame;
 
154
    KToggleAction* m_useKonsoleSettings;
 
155
 
 
156
    KSelectAction* selectBell;
 
157
    KSelectAction* selectLineSpacing;
 
158
    KSelectAction* selectScrollbar;
 
159
    KSelectAction* selectSetEncoding;
 
160
 
 
161
    KActionMenu* m_fontsizes;
 
162
 
 
163
    KPopupMenu* m_keytab;
 
164
    KPopupMenu* m_schema;
 
165
    KPopupMenu* m_signals;
 
166
    KPopupMenu* m_options;
 
167
    KPopupMenu* m_popupMenu;
 
168
 
 
169
    QFont       defaultFont;
 
170
 
 
171
    QString     pmPath; // pixmap path
 
172
    QString     s_schema;
 
173
    QString     s_kconfigSchema;
 
174
    QString     s_word_seps;                    // characters that are considered part of a word
 
175
 
 
176
    bool        b_framevis:1;
 
177
    bool        b_histEnabled:1;
 
178
    bool        b_useKonsoleSettings:1;
 
179
    bool        b_autoDestroy:1;
 
180
    bool        b_autoStartShell:1;
 
181
 
 
182
    int         curr_schema; // current schema no
 
183
    int         n_bell;
 
184
    int         n_keytab;
 
185
    int         n_render;
 
186
    int         n_scroll;
 
187
    unsigned    m_histSize;
 
188
    bool        m_runningShell;
 
189
    bool        m_streamEnabled;
 
190
    int         n_encoding;
 
191
 
 
192
public:
 
193
    // these are the implementations for the TermEmuInterface
 
194
    // functions...
 
195
    void startProgram( const QString& program,
 
196
                       const QStrList& args );
 
197
    void newSession();
 
198
    void showShellInDir( const QString& dir );
 
199
    void sendInput( const QString& text );
 
200
    void setAutoDestroy( bool );
 
201
    void setAutoStartShell( bool );
 
202
};
 
203
 
 
204
//////////////////////////////////////////////////////////////////////
 
205
 
 
206
/*class HistoryTypeDialog : public KDialogBase
 
207
{
 
208
    Q_OBJECT
 
209
public:
 
210
  HistoryTypeDialog(const HistoryType& histType,
 
211
                    unsigned int histSize,
 
212
                    QWidget *parent);
 
213
 
 
214
public slots:
 
215
  void slotDefault();
 
216
  void slotSetUnlimited();
 
217
  void slotHistEnable(bool);
 
218
 
 
219
  unsigned int nbLines() const;
 
220
  bool isOn() const;
 
221
 
 
222
protected:
 
223
  QCheckBox* m_btnEnable;
 
224
  QSpinBox*  m_size;
 
225
  QPushButton* m_setUnlimited;
 
226
};*/
 
227
 
 
228
//////////////////////////////////////////////////////////////////////
 
229
 
 
230
class konsoleBrowserExtension : public KParts::BrowserExtension
 
231
{
 
232
    Q_OBJECT
 
233
        friend class konsolePart;
 
234
 public:
 
235
    konsoleBrowserExtension(konsolePart *parent);
 
236
    virtual ~konsoleBrowserExtension();
 
237
 
 
238
    void emitOpenURLRequest(const KURL &url);
 
239
};
 
240
 
 
241
#endif