-rw-r--r-- | noncore/apps/tinykate/tinykate.cpp | 5 | ||||
-rw-r--r-- | noncore/apps/tinykate/tinykate.h | 1 |
2 files changed, 6 insertions, 0 deletions
diff --git a/noncore/apps/tinykate/tinykate.cpp b/noncore/apps/tinykate/tinykate.cpp index 694efc6..ea7ea45 100644 --- a/noncore/apps/tinykate/tinykate.cpp +++ b/noncore/apps/tinykate/tinykate.cpp | |||
@@ -1,271 +1,276 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | tinykate.cpp | 2 | tinykate.cpp |
3 | Tiny KATE mainwindow | 3 | Tiny KATE mainwindow |
4 | ------------------- | 4 | ------------------- |
5 | begin : November 2002 | 5 | begin : November 2002 |
6 | copyright : (C) 2002 by Joseph Wenninger <jowenn@kde.org> | 6 | copyright : (C) 2002 by Joseph Wenninger <jowenn@kde.org> |
7 | ***************************************************************************/ | 7 | ***************************************************************************/ |
8 | 8 | ||
9 | /*************************************************************************** | 9 | /*************************************************************************** |
10 | * * | 10 | * * |
11 | * This program is free softwaSre; you can redistribute it and/or modify * | 11 | * This program is free softwaSre; you can redistribute it and/or modify * |
12 | * it under the terms of the GNU General Public License as published by * | 12 | * it under the terms of the GNU General Public License as published by * |
13 | * the Free Software Foundation. * | 13 | * the Free Software Foundation. * |
14 | * ONLY VERSION 2 OF THE LICENSE IS APPLICABLE * | 14 | * ONLY VERSION 2 OF THE LICENSE IS APPLICABLE * |
15 | * * | 15 | * * |
16 | ***************************************************************************/ | 16 | ***************************************************************************/ |
17 | #include <qwidget.h> | 17 | #include <qwidget.h> |
18 | #include <qaction.h> | 18 | #include <qaction.h> |
19 | #include <qlayout.h> | 19 | #include <qlayout.h> |
20 | #include <qtoolbutton.h> | 20 | #include <qtoolbutton.h> |
21 | #include <qmenubar.h> | 21 | #include <qmenubar.h> |
22 | #include <qpe/resource.h> | 22 | #include <qpe/resource.h> |
23 | #include <qpe/global.h> | 23 | #include <qpe/global.h> |
24 | #include <qpe/qpeapplication.h> | 24 | #include <qpe/qpeapplication.h> |
25 | 25 | ||
26 | #include <opie/ofiledialog.h> | 26 | #include <opie/ofiledialog.h> |
27 | 27 | ||
28 | #include "tinykate.h" | 28 | #include "tinykate.h" |
29 | 29 | ||
30 | #include <katedocument.h> | 30 | #include <katedocument.h> |
31 | #include <katehighlight.h> | 31 | #include <katehighlight.h> |
32 | #include <kateview.h> | 32 | #include <kateview.h> |
33 | #include <kglobal.h> | 33 | #include <kglobal.h> |
34 | 34 | ||
35 | TinyKate::TinyKate( QWidget *parent, const char *name, WFlags f) : | 35 | TinyKate::TinyKate( QWidget *parent, const char *name, WFlags f) : |
36 | QMainWindow( parent, name, f ) | 36 | QMainWindow( parent, name, f ) |
37 | { | 37 | { |
38 | nextUnnamed=0; | 38 | nextUnnamed=0; |
39 | currentView=0; | 39 | currentView=0; |
40 | viewCount=0; | 40 | viewCount=0; |
41 | setCaption(tr("TinyKATE")); | 41 | setCaption(tr("TinyKATE")); |
42 | KGlobal::setAppName("TinyKATE"); | 42 | KGlobal::setAppName("TinyKATE"); |
43 | 43 | ||
44 | QMenuBar *mb = new QMenuBar( this ); | 44 | QMenuBar *mb = new QMenuBar( this ); |
45 | mb->setMargin( 0 ); | 45 | mb->setMargin( 0 ); |
46 | 46 | ||
47 | tabwidget=new OTabWidget(this); | 47 | tabwidget=new OTabWidget(this); |
48 | setCentralWidget(tabwidget); | 48 | setCentralWidget(tabwidget); |
49 | connect(tabwidget,SIGNAL(currentChanged( QWidget *)),this,SLOT(slotCurrentChanged(QWidget *))); | 49 | connect(tabwidget,SIGNAL(currentChanged( QWidget *)),this,SLOT(slotCurrentChanged(QWidget *))); |
50 | 50 | ||
51 | //FILE ACTIONS | 51 | //FILE ACTIONS |
52 | QPopupMenu *popup = new QPopupMenu( this ); | 52 | QPopupMenu *popup = new QPopupMenu( this ); |
53 | 53 | ||
54 | // Action for creating a new document | 54 | // Action for creating a new document |
55 | QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); | 55 | QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); |
56 | a->addTo( popup ); | 56 | a->addTo( popup ); |
57 | connect(a, SIGNAL(activated()), this, SLOT(slotNew())); | 57 | connect(a, SIGNAL(activated()), this, SLOT(slotNew())); |
58 | 58 | ||
59 | // Action for opening an exisiting document | 59 | // Action for opening an exisiting document |
60 | a = new QAction( tr( "Open" ),Resource::loadPixmap( "fileopen" ) , QString::null, 0, this, 0 ); | 60 | a = new QAction( tr( "Open" ),Resource::loadPixmap( "fileopen" ) , QString::null, 0, this, 0 ); |
61 | a->addTo(popup); | 61 | a->addTo(popup); |
62 | connect(a, SIGNAL(activated()), this, SLOT(slotOpen())); | 62 | connect(a, SIGNAL(activated()), this, SLOT(slotOpen())); |
63 | 63 | ||
64 | 64 | ||
65 | // Action for saving document | 65 | // Action for saving document |
66 | a = new QAction( tr( "Save" ), Resource::loadPixmap( "save" ) , QString::null, 0, this, 0 ); | 66 | a = new QAction( tr( "Save" ), Resource::loadPixmap( "save" ) , QString::null, 0, this, 0 ); |
67 | a->addTo(popup); | 67 | a->addTo(popup); |
68 | connect(a, SIGNAL(activated()), this, SLOT(slotSave())); | 68 | connect(a, SIGNAL(activated()), this, SLOT(slotSave())); |
69 | 69 | ||
70 | // Action for saving document to a new name | 70 | // Action for saving document to a new name |
71 | a = new QAction( tr( "Save As" ),Resource::loadPixmap( "save" ) , QString::null, 0, this, 0 ); | 71 | a = new QAction( tr( "Save As" ),Resource::loadPixmap( "save" ) , QString::null, 0, this, 0 ); |
72 | a->addTo(popup); | 72 | a->addTo(popup); |
73 | connect(a, SIGNAL(activated()), this, SLOT(slotSaveAs())); | 73 | connect(a, SIGNAL(activated()), this, SLOT(slotSaveAs())); |
74 | 74 | ||
75 | // Action for closing the currently active document | 75 | // Action for closing the currently active document |
76 | a = new QAction( tr( "Close" ), Resource::loadPixmap( "quit_icon" ) , QString::null, 0, this, 0 ); | 76 | a = new QAction( tr( "Close" ), Resource::loadPixmap( "quit_icon" ) , QString::null, 0, this, 0 ); |
77 | a->addTo(popup); | 77 | a->addTo(popup); |
78 | connect(a, SIGNAL(activated()), this, SLOT(slotClose())); | 78 | connect(a, SIGNAL(activated()), this, SLOT(slotClose())); |
79 | 79 | ||
80 | 80 | ||
81 | mb->insertItem(tr("File"),popup); | 81 | mb->insertItem(tr("File"),popup); |
82 | 82 | ||
83 | //EDIT ACTIONS | 83 | //EDIT ACTIONS |
84 | 84 | ||
85 | // Action for cutting text | 85 | // Action for cutting text |
86 | editCut = new QToolButton( 0 ); | 86 | editCut = new QToolButton( 0 ); |
87 | editCut->setAutoRaise( true ); | 87 | editCut->setAutoRaise( true ); |
88 | editCut->setIconSet( Resource::loadPixmap( "cut" ) ); | 88 | editCut->setIconSet( Resource::loadPixmap( "cut" ) ); |
89 | 89 | ||
90 | // Action for Copying text | 90 | // Action for Copying text |
91 | editCopy = new QToolButton( 0 ); | 91 | editCopy = new QToolButton( 0 ); |
92 | editCopy->setAutoRaise( true ); | 92 | editCopy->setAutoRaise( true ); |
93 | editCopy->setIconSet( Resource::loadPixmap( "copy" ) ); | 93 | editCopy->setIconSet( Resource::loadPixmap( "copy" ) ); |
94 | 94 | ||
95 | // Action for pasting text | 95 | // Action for pasting text |
96 | editPaste = new QToolButton( 0 ); | 96 | editPaste = new QToolButton( 0 ); |
97 | editPaste->setAutoRaise( true ); | 97 | editPaste->setAutoRaise( true ); |
98 | editPaste->setIconSet( Resource::loadPixmap( "paste" ) ); | 98 | editPaste->setIconSet( Resource::loadPixmap( "paste" ) ); |
99 | 99 | ||
100 | // Action for finding / replacing text | 100 | // Action for finding / replacing text |
101 | editFindReplace = new QToolButton( 0 ); | 101 | editFindReplace = new QToolButton( 0 ); |
102 | editFindReplace->setAutoRaise( true ); | 102 | editFindReplace->setAutoRaise( true ); |
103 | editFindReplace->setIconSet( Resource::loadPixmap("find") ); | 103 | editFindReplace->setIconSet( Resource::loadPixmap("find") ); |
104 | 104 | ||
105 | // Action for undo | 105 | // Action for undo |
106 | editUndo = new QToolButton( 0 ); | 106 | editUndo = new QToolButton( 0 ); |
107 | editUndo->setAutoRaise( true ); | 107 | editUndo->setAutoRaise( true ); |
108 | editUndo->setIconSet( Resource::loadPixmap( "undo" ) ); | 108 | editUndo->setIconSet( Resource::loadPixmap( "undo" ) ); |
109 | 109 | ||
110 | // Action for redo | 110 | // Action for redo |
111 | editRedo = new QToolButton( 0 ); | 111 | editRedo = new QToolButton( 0 ); |
112 | editRedo->setAutoRaise( true ); | 112 | editRedo->setAutoRaise( true ); |
113 | editRedo->setIconSet( Resource::loadPixmap( "redo" ) ); | 113 | editRedo->setIconSet( Resource::loadPixmap( "redo" ) ); |
114 | 114 | ||
115 | //VIEW ACITONS | 115 | //VIEW ACITONS |
116 | popup = new QPopupMenu( this ); | 116 | popup = new QPopupMenu( this ); |
117 | 117 | ||
118 | viewIncFontSizes = new QAction( tr( "Font +" ), QString::null, 0, this, 0 ); | 118 | viewIncFontSizes = new QAction( tr( "Font +" ), QString::null, 0, this, 0 ); |
119 | viewIncFontSizes->addTo( popup ); | 119 | viewIncFontSizes->addTo( popup ); |
120 | 120 | ||
121 | viewDecFontSizes = new QAction( tr( "Font -" ), QString::null, 0, this, 0 ); | 121 | viewDecFontSizes = new QAction( tr( "Font -" ), QString::null, 0, this, 0 ); |
122 | viewDecFontSizes->addTo( popup ); | 122 | viewDecFontSizes->addTo( popup ); |
123 | 123 | ||
124 | mb->insertItem(tr("View"),popup); | 124 | mb->insertItem(tr("View"),popup); |
125 | 125 | ||
126 | popup = new QPopupMenu( this ); | 126 | popup = new QPopupMenu( this ); |
127 | mb->insertItem(tr("Utils"),popup); | 127 | mb->insertItem(tr("Utils"),popup); |
128 | 128 | ||
129 | 129 | ||
130 | mb->insertItem( editCut ); | 130 | mb->insertItem( editCut ); |
131 | mb->insertItem( editCopy ); | 131 | mb->insertItem( editCopy ); |
132 | mb->insertItem( editPaste ); | 132 | mb->insertItem( editPaste ); |
133 | mb->insertItem( editFindReplace ); | 133 | mb->insertItem( editFindReplace ); |
134 | mb->insertItem( editUndo ); | 134 | mb->insertItem( editUndo ); |
135 | mb->insertItem( editRedo ); | 135 | mb->insertItem( editRedo ); |
136 | 136 | ||
137 | 137 | ||
138 | //Highlight management | 138 | //Highlight management |
139 | hlmenu=new QPopupMenu(this); | 139 | hlmenu=new QPopupMenu(this); |
140 | HlManager *hlm=HlManager::self(); | 140 | HlManager *hlm=HlManager::self(); |
141 | for (int i=0;i<hlm->highlights();i++) | 141 | for (int i=0;i<hlm->highlights();i++) |
142 | { | 142 | { |
143 | hlmenu->insertItem(hlm->hlName(i),i); | 143 | hlmenu->insertItem(hlm->hlName(i),i); |
144 | } | 144 | } |
145 | popup->insertItem(tr("Highlighting"),hlmenu); | 145 | popup->insertItem(tr("Highlighting"),hlmenu); |
146 | 146 | ||
147 | 147 | ||
148 | utilSettings = new QAction( tr( "Settings" ), QString::null, 0, this, 0 ); | 148 | utilSettings = new QAction( tr( "Settings" ), QString::null, 0, this, 0 ); |
149 | utilSettings->addTo( popup); | 149 | utilSettings->addTo( popup); |
150 | 150 | ||
151 | if( qApp->argc() > 1) open(qApp->argv()[1]); | 151 | if( qApp->argc() > 1) open(qApp->argv()[1]); |
152 | else slotNew(); | 152 | else slotNew(); |
153 | 153 | ||
154 | } | 154 | } |
155 | 155 | ||
156 | TinyKate::~TinyKate( ) | 156 | TinyKate::~TinyKate( ) |
157 | { | 157 | { |
158 | qWarning("TinyKate destructor\n"); | 158 | qWarning("TinyKate destructor\n"); |
159 | if( KGlobal::config() != 0 ) { | 159 | if( KGlobal::config() != 0 ) { |
160 | qWarning("deleting KateConfig object..\n"); | 160 | qWarning("deleting KateConfig object..\n"); |
161 | delete KGlobal::config(); | 161 | delete KGlobal::config(); |
162 | } | 162 | } |
163 | } | 163 | } |
164 | 164 | ||
165 | void TinyKate::slotOpen( ) | 165 | void TinyKate::slotOpen( ) |
166 | { | 166 | { |
167 | QString filename = OFileDialog::getOpenFileName( OFileSelector::EXTENDED_ALL, | 167 | QString filename = OFileDialog::getOpenFileName( OFileSelector::EXTENDED_ALL, |
168 | QPEApplication::documentDir()); | 168 | QPEApplication::documentDir()); |
169 | if (!filename.isEmpty()) { | 169 | if (!filename.isEmpty()) { |
170 | open(filename); | 170 | open(filename); |
171 | } | 171 | } |
172 | } | 172 | } |
173 | 173 | ||
174 | void TinyKate::open(const QString & filename) | 174 | void TinyKate::open(const QString & filename) |
175 | { | 175 | { |
176 | KateDocument *kd= new KateDocument(false, false, this,0,this); | 176 | KateDocument *kd= new KateDocument(false, false, this,0,this); |
177 | KTextEditor::View *kv; | 177 | KTextEditor::View *kv; |
178 | QFileInfo fi(filename); | 178 | QFileInfo fi(filename); |
179 | QString filenamed = fi.fileName(); | 179 | QString filenamed = fi.fileName(); |
180 | tabwidget->addTab(kv=kd->createView(tabwidget,"bLAH"),"tinykate/tinykate", filenamed ); | 180 | tabwidget->addTab(kv=kd->createView(tabwidget,"bLAH"),"tinykate/tinykate", filenamed ); |
181 | qDebug(filename); | 181 | qDebug(filename); |
182 | 182 | ||
183 | kd->setDocName( filenamed); | 183 | kd->setDocName( filenamed); |
184 | kd->open( filename ); | 184 | kd->open( filename ); |
185 | viewCount++; | 185 | viewCount++; |
186 | } | 186 | } |
187 | 187 | ||
188 | void TinyKate::setDocument(const QString& fileref) | ||
189 | { | ||
190 | open( fileref ); | ||
191 | } | ||
192 | |||
188 | void TinyKate::slotCurrentChanged( QWidget * view) | 193 | void TinyKate::slotCurrentChanged( QWidget * view) |
189 | { | 194 | { |
190 | if (currentView) { | 195 | if (currentView) { |
191 | 196 | ||
192 | disconnect(editCopy,SIGNAL(activated()),currentView,SLOT(copy())); | 197 | disconnect(editCopy,SIGNAL(activated()),currentView,SLOT(copy())); |
193 | disconnect(editCut,SIGNAL(activated()),currentView,SLOT(cut())); | 198 | disconnect(editCut,SIGNAL(activated()),currentView,SLOT(cut())); |
194 | disconnect(editPaste,SIGNAL(activated()),currentView,SLOT(paste())); | 199 | disconnect(editPaste,SIGNAL(activated()),currentView,SLOT(paste())); |
195 | disconnect(editUndo,SIGNAL(activated()),currentView,SLOT(undo())); | 200 | disconnect(editUndo,SIGNAL(activated()),currentView,SLOT(undo())); |
196 | disconnect(editRedo,SIGNAL(activated()),currentView,SLOT(redo())); | 201 | disconnect(editRedo,SIGNAL(activated()),currentView,SLOT(redo())); |
197 | disconnect(viewIncFontSizes,SIGNAL(activated()), currentView,SLOT(slotIncFontSizes())); | 202 | disconnect(viewIncFontSizes,SIGNAL(activated()), currentView,SLOT(slotIncFontSizes())); |
198 | disconnect(viewDecFontSizes,SIGNAL(activated()), currentView,SLOT(slotDecFontSizes())); | 203 | disconnect(viewDecFontSizes,SIGNAL(activated()), currentView,SLOT(slotDecFontSizes())); |
199 | disconnect(hlmenu,SIGNAL(activated(int)), currentView,SLOT(setHl(int))); | 204 | disconnect(hlmenu,SIGNAL(activated(int)), currentView,SLOT(setHl(int))); |
200 | disconnect(utilSettings,SIGNAL(activated()), currentView,SLOT(configDialog())); | 205 | disconnect(utilSettings,SIGNAL(activated()), currentView,SLOT(configDialog())); |
201 | } | 206 | } |
202 | 207 | ||
203 | currentView=(KTextEditor::View*)view; | 208 | currentView=(KTextEditor::View*)view; |
204 | 209 | ||
205 | connect(editCopy,SIGNAL(clicked()),currentView,SLOT(copy())); | 210 | connect(editCopy,SIGNAL(clicked()),currentView,SLOT(copy())); |
206 | connect(editCut,SIGNAL(clicked()),currentView,SLOT(cut())); | 211 | connect(editCut,SIGNAL(clicked()),currentView,SLOT(cut())); |
207 | connect(editPaste,SIGNAL(clicked()),currentView,SLOT(paste())); | 212 | connect(editPaste,SIGNAL(clicked()),currentView,SLOT(paste())); |
208 | connect(editUndo,SIGNAL(clicked()),currentView,SLOT(undo())); | 213 | connect(editUndo,SIGNAL(clicked()),currentView,SLOT(undo())); |
209 | connect(editRedo,SIGNAL(clicked()),currentView,SLOT(redo())); | 214 | connect(editRedo,SIGNAL(clicked()),currentView,SLOT(redo())); |
210 | connect(viewIncFontSizes,SIGNAL(activated()), currentView,SLOT(slotIncFontSizes())); | 215 | connect(viewIncFontSizes,SIGNAL(activated()), currentView,SLOT(slotIncFontSizes())); |
211 | connect(viewDecFontSizes,SIGNAL(activated()), currentView,SLOT(slotDecFontSizes())); | 216 | connect(viewDecFontSizes,SIGNAL(activated()), currentView,SLOT(slotDecFontSizes())); |
212 | connect(hlmenu,SIGNAL(activated(int)), currentView,SLOT(setHl(int))); | 217 | connect(hlmenu,SIGNAL(activated(int)), currentView,SLOT(setHl(int))); |
213 | connect(utilSettings,SIGNAL(activated()), currentView,SLOT(configDialog())); | 218 | connect(utilSettings,SIGNAL(activated()), currentView,SLOT(configDialog())); |
214 | 219 | ||
215 | } | 220 | } |
216 | 221 | ||
217 | void TinyKate::slotNew( ) | 222 | void TinyKate::slotNew( ) |
218 | { | 223 | { |
219 | KateDocument *kd= new KateDocument(false, false, this,0,this); | 224 | KateDocument *kd= new KateDocument(false, false, this,0,this); |
220 | KTextEditor::View *kv; | 225 | KTextEditor::View *kv; |
221 | tabwidget->addTab(kv=kd->createView(tabwidget,"BLAH"), | 226 | tabwidget->addTab(kv=kd->createView(tabwidget,"BLAH"), |
222 | "tinykate/tinykate", | 227 | "tinykate/tinykate", |
223 | tr("Unnamed %1").arg(nextUnnamed++)); | 228 | tr("Unnamed %1").arg(nextUnnamed++)); |
224 | viewCount++; | 229 | viewCount++; |
225 | } | 230 | } |
226 | 231 | ||
227 | void TinyKate::slotClose( ) | 232 | void TinyKate::slotClose( ) |
228 | { | 233 | { |
229 | if (currentView==0) return; | 234 | if (currentView==0) return; |
230 | KTextEditor::View *dv=currentView; | 235 | KTextEditor::View *dv=currentView; |
231 | currentView=0; | 236 | currentView=0; |
232 | tabwidget->removePage(dv); | 237 | tabwidget->removePage(dv); |
233 | delete dv->document(); | 238 | delete dv->document(); |
234 | viewCount--; | 239 | viewCount--; |
235 | if (!viewCount) slotNew(); | 240 | if (!viewCount) slotNew(); |
236 | } | 241 | } |
237 | 242 | ||
238 | void TinyKate::slotSave() { | 243 | void TinyKate::slotSave() { |
239 | // feel free to make this how you want | 244 | // feel free to make this how you want |
240 | if (currentView==0) return; | 245 | if (currentView==0) return; |
241 | 246 | ||
242 | // KateView *kv = (KateView*) currentView; | 247 | // KateView *kv = (KateView*) currentView; |
243 | KateDocument *kd = (KateDocument*) currentView->document(); | 248 | KateDocument *kd = (KateDocument*) currentView->document(); |
244 | // qDebug("saving file "+kd->docName()); | 249 | // qDebug("saving file "+kd->docName()); |
245 | if( kd->docName().isEmpty()) | 250 | if( kd->docName().isEmpty()) |
246 | slotSaveAs(); | 251 | slotSaveAs(); |
247 | else | 252 | else |
248 | kd->saveFile(); | 253 | kd->saveFile(); |
249 | // kv->save(); | 254 | // kv->save(); |
250 | // kd->saveFile(); | 255 | // kd->saveFile(); |
251 | } | 256 | } |
252 | 257 | ||
253 | void TinyKate::slotSaveAs() { | 258 | void TinyKate::slotSaveAs() { |
254 | if (currentView==0) return; | 259 | if (currentView==0) return; |
255 | KateDocument *kd = (KateDocument*) currentView->document(); | 260 | KateDocument *kd = (KateDocument*) currentView->document(); |
256 | 261 | ||
257 | QString filename=OFileDialog::getSaveFileName(OFileSelector::EXTENDED_ALL, | 262 | QString filename=OFileDialog::getSaveFileName(OFileSelector::EXTENDED_ALL, |
258 | QPEApplication::documentDir()); | 263 | QPEApplication::documentDir()); |
259 | if (!filename.isEmpty()) { | 264 | if (!filename.isEmpty()) { |
260 | qDebug("saving file "+filename); | 265 | qDebug("saving file "+filename); |
261 | QFileInfo fi(filename); | 266 | QFileInfo fi(filename); |
262 | QString filenamed = fi.fileName(); | 267 | QString filenamed = fi.fileName(); |
263 | kd->setDocFile( filename); | 268 | kd->setDocFile( filename); |
264 | kd->setDocName( filenamed); | 269 | kd->setDocName( filenamed); |
265 | kd->saveFile(); | 270 | kd->saveFile(); |
266 | // KTextEditor::View *dv = currentView; | 271 | // KTextEditor::View *dv = currentView; |
267 | // tabwidget->changeTab( dv, filenamed); | 272 | // tabwidget->changeTab( dv, filenamed); |
268 | // need to change tab label here | 273 | // need to change tab label here |
269 | } | 274 | } |
270 | 275 | ||
271 | } | 276 | } |
diff --git a/noncore/apps/tinykate/tinykate.h b/noncore/apps/tinykate/tinykate.h index cdd8f43..2e8ca74 100644 --- a/noncore/apps/tinykate/tinykate.h +++ b/noncore/apps/tinykate/tinykate.h | |||
@@ -1,62 +1,63 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | tinykate.h | 2 | tinykate.h |
3 | Tiny KATE mainwindow | 3 | Tiny KATE mainwindow |
4 | ------------------- | 4 | ------------------- |
5 | begin : November 2002 | 5 | begin : November 2002 |
6 | copyright : (C) 2002 by Joseph Wenninger <jowenn@kde.org> | 6 | copyright : (C) 2002 by Joseph Wenninger <jowenn@kde.org> |
7 | ***************************************************************************/ | 7 | ***************************************************************************/ |
8 | 8 | ||
9 | /*************************************************************************** | 9 | /*************************************************************************** |
10 | * * | 10 | * * |
11 | * This program is free software; you can redistribute it and/or modify * | 11 | * This program is free software; you can redistribute it and/or modify * |
12 | * it under the terms of the GNU General Public License as published by * | 12 | * it under the terms of the GNU General Public License as published by * |
13 | * the Free Software Foundation. * | 13 | * the Free Software Foundation. * |
14 | * ONLY VERSION 2 OF THE LICENSE IS APPLICABLE * | 14 | * ONLY VERSION 2 OF THE LICENSE IS APPLICABLE * |
15 | * * | 15 | * * |
16 | ***************************************************************************/ | 16 | ***************************************************************************/ |
17 | 17 | ||
18 | #ifndef __TINYKATE_H__ | 18 | #ifndef __TINYKATE_H__ |
19 | #define __TINYKATE_H__ | 19 | #define __TINYKATE_H__ |
20 | 20 | ||
21 | 21 | ||
22 | #include <qmainwindow.h> | 22 | #include <qmainwindow.h> |
23 | #include <opie/otabwidget.h> | 23 | #include <opie/otabwidget.h> |
24 | #include <ktexteditor.h> | 24 | #include <ktexteditor.h> |
25 | 25 | ||
26 | class QToolButton; | 26 | class QToolButton; |
27 | class QAction; | 27 | class QAction; |
28 | class QPopupMenu; | 28 | class QPopupMenu; |
29 | 29 | ||
30 | class TinyKate : public QMainWindow | 30 | class TinyKate : public QMainWindow |
31 | { | 31 | { |
32 | Q_OBJECT | 32 | Q_OBJECT |
33 | public: | 33 | public: |
34 | TinyKate( QWidget *parent=0, const char *name=0, WFlags f = 0); | 34 | TinyKate( QWidget *parent=0, const char *name=0, WFlags f = 0); |
35 | ~TinyKate( ); | 35 | ~TinyKate( ); |
36 | 36 | ||
37 | public slots: | 37 | public slots: |
38 | void slotNew(); | 38 | void slotNew(); |
39 | void setDocument(const QString& fileref); | ||
39 | 40 | ||
40 | protected slots: | 41 | protected slots: |
41 | void slotOpen(); | 42 | void slotOpen(); |
42 | void slotClose(); | 43 | void slotClose(); |
43 | void slotCurrentChanged(QWidget *); | 44 | void slotCurrentChanged(QWidget *); |
44 | void slotSave(); | 45 | void slotSave(); |
45 | void slotSaveAs(); | 46 | void slotSaveAs(); |
46 | protected: | 47 | protected: |
47 | void open(const QString&); | 48 | void open(const QString&); |
48 | private: | 49 | private: |
49 | QString currentFileName; | 50 | QString currentFileName; |
50 | OTabWidget *tabwidget; | 51 | OTabWidget *tabwidget; |
51 | KTextEditor::View *currentView; | 52 | KTextEditor::View *currentView; |
52 | 53 | ||
53 | QToolButton *editCopy, *editCut, *editPaste, *editUndo, *editRedo, *editFindReplace; | 54 | QToolButton *editCopy, *editCut, *editPaste, *editUndo, *editRedo, *editFindReplace; |
54 | QAction *viewIncFontSizes, *viewDecFontSizes, *utilSettings; | 55 | QAction *viewIncFontSizes, *viewDecFontSizes, *utilSettings; |
55 | 56 | ||
56 | QPopupMenu *hlmenu; | 57 | QPopupMenu *hlmenu; |
57 | uint nextUnnamed; | 58 | uint nextUnnamed; |
58 | uint viewCount; | 59 | uint viewCount; |
59 | }; | 60 | }; |
60 | 61 | ||
61 | 62 | ||
62 | #endif // __TINYKATE_H__ | 63 | #endif // __TINYKATE_H__ |