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

« back to all changes in this revision

Viewing changes to extra/kde322/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
/*
 
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., 59 Temple Place - Suite 330,
 
18
    Boston, MA 02111-1307, 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 QCheckBox;
 
41
class KRootPixmap;
 
42
class KToggleAction;
 
43
class KSelectAction;
 
44
 
 
45
namespace KParts { class GUIActivateEvent; }
 
46
 
 
47
class konsoleFactory : public KParts::Factory
 
48
{
 
49
    Q_OBJECT
 
50
public:
 
51
    konsoleFactory();
 
52
    virtual ~konsoleFactory();
 
53
 
 
54
    virtual KParts::Part* createPartObject(QWidget *parentWidget = 0, const char *widgetName = 0,
 
55
                                     QObject* parent = 0, const char* name = 0,
 
56
                                     const char* classname = "KParts::Part",
 
57
                                     const QStringList &args = QStringList());
 
58
 
 
59
    static KInstance *instance();
 
60
 
 
61
 private:
 
62
    static KInstance *s_instance;
 
63
    static KAboutData *s_aboutData;
 
64
};
 
65
 
 
66
//////////////////////////////////////////////////////////////////////
 
67
 
 
68
class konsolePart: public KParts::ReadOnlyPart, public TerminalInterface
 
69
{
 
70
    Q_OBJECT
 
71
        public:
 
72
    konsolePart(QWidget *parentWidget, const char *widgetName, QObject * parent, const char *name, const char *classname = 0);
 
73
    virtual ~konsolePart();
 
74
 
 
75
signals:
 
76
    void processExited();
 
77
    void receivedData( const QString& s );
 
78
 protected:
 
79
    virtual bool openURL( const KURL & url );
 
80
    virtual bool openFile() {return false;} // never used
 
81
    virtual bool closeURL() {return true;}
 
82
    virtual void guiActivateEvent( KParts::GUIActivateEvent * event );
 
83
 
 
84
 protected slots:
 
85
    void showShell();
 
86
    void slotProcessExited();
 
87
    void slotReceivedData( const QString& s );
 
88
 
 
89
//    void doneSession(TESession*);
 
90
    void sessionDestroyed();
 
91
//    void configureRequest(TEWidget*,int,int x,int y);
 
92
    void updateTitle();
 
93
    void enableMasterModeConnections();
 
94
 
 
95
 private slots:
 
96
    void emitOpenURLRequest(const QString &url);
 
97
 
 
98
    void readProperties();
 
99
    void saveProperties();
 
100
 
 
101
    void sendSignal(int n);
 
102
    void closeCurrentSession();
 
103
 
 
104
    void notifySize(int,int);
 
105
 
 
106
    void slotToggleFrame();
 
107
    void slotSelectScrollbar();
 
108
    void slotSelectFont();
 
109
    void schema_menu_check();
 
110
    void keytab_menu_activated(int item);
 
111
    void updateSchemaMenu();
 
112
    void setSchema(int n);
 
113
    void pixmap_menu_activated(int item);
 
114
    void schema_menu_activated(int item);
 
115
    void slotHistoryType();
 
116
    void slotSelectBell();
 
117
    void slotSelectLineSpacing();
 
118
    void slotBlinkingCursor();
 
119
    void slotWordSeps();
 
120
    void fontNotFound();
 
121
 
 
122
 private:
 
123
    konsoleBrowserExtension *m_extension;
 
124
    KURL currentURL;
 
125
 
 
126
    void makeGUI();
 
127
    void applySettingsToGUI();
 
128
 
 
129
    void setFont(int fontno);
 
130
//    void setSchema(ColorSchema* s);
 
131
    void updateKeytabMenu();
 
132
 
 
133
        bool doOpenStream( const QString& );
 
134
        bool doWriteStream( const QByteArray& );
 
135
        bool doCloseStream();
 
136
 
 
137
    QWidget* parentWidget;
 
138
//    TEWidget* te;
 
139
//    TESession* se;
 
140
//    ColorSchemaList* colors;
 
141
    KRootPixmap* rootxpm;
 
142
 
 
143
    KToggleAction* blinkingCursor;
 
144
    KToggleAction* showFrame;
 
145
 
 
146
    KSelectAction* selectBell;
 
147
    KSelectAction* selectFont;
 
148
    KSelectAction* selectLineSpacing;
 
149
    KSelectAction* selectScrollbar;
 
150
 
 
151
    KPopupMenu* m_keytab;
 
152
    KPopupMenu* m_schema;
 
153
    KPopupMenu* m_signals;
 
154
    KPopupMenu* m_options;
 
155
    KPopupMenu* m_popupMenu;
 
156
 
 
157
    QFont       defaultFont;
 
158
 
 
159
    QString     pmPath; // pixmap path
 
160
    QString     s_schema;
 
161
    QString     s_kconfigSchema;
 
162
    QString     s_word_seps;                    // characters that are considered part of a word
 
163
    QString     fontNotFound_par;
 
164
 
 
165
    bool        b_framevis:1;
 
166
    bool        b_histEnabled:1;
 
167
 
 
168
    int         curr_schema; // current schema no
 
169
    int         n_bell;
 
170
    int         n_font;
 
171
    int         n_keytab;
 
172
    int         n_render;
 
173
    int         n_scroll;
 
174
    unsigned    m_histSize;
 
175
    bool        m_runningShell;
 
176
    bool        m_streamEnabled;
 
177
public:
 
178
    // these are the implementations for the TermEmuInterface
 
179
    // functions...
 
180
    void startProgram( const QString& program,
 
181
                       const QStrList& args );
 
182
    void showShellInDir( const QString& dir );
 
183
    void sendInput( const QString& text );
 
184
};
 
185
 
 
186
//////////////////////////////////////////////////////////////////////
 
187
 
 
188
/*class HistoryTypeDialog : public KDialogBase
 
189
{
 
190
    Q_OBJECT
 
191
public:
 
192
  HistoryTypeDialog(const HistoryType& histType,
 
193
                    unsigned int histSize,
 
194
                    QWidget *parent);
 
195
 
 
196
public slots:
 
197
  void slotDefault();
 
198
  void slotSetUnlimited();
 
199
  void slotHistEnable(bool);
 
200
 
 
201
  unsigned int nbLines() const;
 
202
  bool isOn() const;
 
203
 
 
204
protected:
 
205
  QCheckBox* m_btnEnable;
 
206
  QSpinBox*  m_size;
 
207
  QPushButton* m_setUnlimited;
 
208
};*/
 
209
 
 
210
//////////////////////////////////////////////////////////////////////
 
211
 
 
212
class konsoleBrowserExtension : public KParts::BrowserExtension
 
213
{
 
214
    Q_OBJECT
 
215
        friend class konsolePart;
 
216
 public:
 
217
    konsoleBrowserExtension(konsolePart *parent);
 
218
    virtual ~konsoleBrowserExtension();
 
219
 
 
220
    void emitOpenURLRequest(const KURL &url);
 
221
};
 
222
 
 
223
#endif