Diffstat (limited to 'noncore/apps/tinykate/tinykate.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/tinykate/tinykate.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/noncore/apps/tinykate/tinykate.cpp b/noncore/apps/tinykate/tinykate.cpp index f470645..bbf80ce 100644 --- a/noncore/apps/tinykate/tinykate.cpp +++ b/noncore/apps/tinykate/tinykate.cpp | |||
@@ -2,49 +2,49 @@ | |||
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 <opie2/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 | shutDown=false; | 38 | shutDown=false; |
39 | nextUnnamed=0; | 39 | nextUnnamed=0; |
40 | currentView=0; | 40 | currentView=0; |
41 | viewCount=0; | 41 | viewCount=0; |
42 | setCaption(tr("TinyKATE")); | 42 | setCaption(tr("TinyKATE")); |
43 | KGlobal::setAppName("TinyKATE"); | 43 | KGlobal::setAppName("TinyKATE"); |
44 | 44 | ||
45 | QMenuBar *mb = new QMenuBar( this ); | 45 | QMenuBar *mb = new QMenuBar( this ); |
46 | mb->setMargin( 0 ); | 46 | mb->setMargin( 0 ); |
47 | 47 | ||
48 | tabwidget=new OTabWidget(this); | 48 | tabwidget=new OTabWidget(this); |
49 | setCentralWidget(tabwidget); | 49 | setCentralWidget(tabwidget); |
50 | connect(tabwidget,SIGNAL(currentChanged( QWidget *)),this,SLOT(slotCurrentChanged(QWidget *))); | 50 | connect(tabwidget,SIGNAL(currentChanged( QWidget *)),this,SLOT(slotCurrentChanged(QWidget *))); |
@@ -139,60 +139,60 @@ TinyKate::TinyKate( QWidget *parent, const char *name, WFlags f) : | |||
139 | //Highlight management | 139 | //Highlight management |
140 | hlmenu=new QPopupMenu(this); | 140 | hlmenu=new QPopupMenu(this); |
141 | HlManager *hlm=HlManager::self(); | 141 | HlManager *hlm=HlManager::self(); |
142 | for (int i=0;i<hlm->highlights();i++) | 142 | for (int i=0;i<hlm->highlights();i++) |
143 | { | 143 | { |
144 | hlmenu->insertItem(hlm->hlName(i),i); | 144 | hlmenu->insertItem(hlm->hlName(i),i); |
145 | } | 145 | } |
146 | popup->insertItem(tr("Highlighting"),hlmenu); | 146 | popup->insertItem(tr("Highlighting"),hlmenu); |
147 | 147 | ||
148 | 148 | ||
149 | utilSettings = new QAction( tr( "Settings" ), QString::null, 0, this, 0 ); | 149 | utilSettings = new QAction( tr( "Settings" ), QString::null, 0, this, 0 ); |
150 | utilSettings->addTo( popup); | 150 | utilSettings->addTo( popup); |
151 | 151 | ||
152 | if( qApp->argc() > 1) open(qApp->argv()[1]); | 152 | if( qApp->argc() > 1) open(qApp->argv()[1]); |
153 | else slotNew(); | 153 | else slotNew(); |
154 | 154 | ||
155 | } | 155 | } |
156 | 156 | ||
157 | TinyKate::~TinyKate( ) | 157 | TinyKate::~TinyKate( ) |
158 | { | 158 | { |
159 | qWarning("TinyKate destructor\n"); | 159 | qWarning("TinyKate destructor\n"); |
160 | 160 | ||
161 | shutDown=true; | 161 | shutDown=true; |
162 | while (currentView!=0) { | 162 | while (currentView!=0) { |
163 | slotClose(); | 163 | slotClose(); |
164 | } | 164 | } |
165 | 165 | ||
166 | if( KGlobal::config() != 0 ) { | 166 | if( KGlobal::config() != 0 ) { |
167 | qWarning("deleting KateConfig object..\n"); | 167 | qWarning("deleting KateConfig object..\n"); |
168 | delete KGlobal::config(); | 168 | delete KGlobal::config(); |
169 | } | 169 | } |
170 | } | 170 | } |
171 | 171 | ||
172 | void TinyKate::slotOpen( ) | 172 | void TinyKate::slotOpen( ) |
173 | { | 173 | { |
174 | QString filename = OFileDialog::getOpenFileName( OFileSelector::EXTENDED_ALL, | 174 | QString filename = Opie::OFileDialog::getOpenFileName( OFileSelector::EXTENDED_ALL, |
175 | QString::null); | 175 | QString::null); |
176 | if (!filename.isEmpty()) { | 176 | if (!filename.isEmpty()) { |
177 | open(filename); | 177 | open(filename); |
178 | } | 178 | } |
179 | } | 179 | } |
180 | 180 | ||
181 | void TinyKate::open(const QString & filename) | 181 | void TinyKate::open(const QString & filename) |
182 | { | 182 | { |
183 | KateDocument *kd= new KateDocument(false, false, this,0,this); | 183 | KateDocument *kd= new KateDocument(false, false, this,0,this); |
184 | KTextEditor::View *kv; | 184 | KTextEditor::View *kv; |
185 | QFileInfo fi(filename); | 185 | QFileInfo fi(filename); |
186 | QString filenamed = fi.fileName(); | 186 | QString filenamed = fi.fileName(); |
187 | tabwidget->addTab(kv=kd->createView(tabwidget,"bLAH"),"tinykate/tinykate", filenamed ); | 187 | tabwidget->addTab(kv=kd->createView(tabwidget,"bLAH"),"tinykate/tinykate", filenamed ); |
188 | qDebug(filename); | 188 | qDebug(filename); |
189 | 189 | ||
190 | kd->setDocName( filenamed); | 190 | kd->setDocName( filenamed); |
191 | kd->open( filename ); | 191 | kd->open( filename ); |
192 | viewCount++; | 192 | viewCount++; |
193 | } | 193 | } |
194 | 194 | ||
195 | void TinyKate::setDocument(const QString& fileref) | 195 | void TinyKate::setDocument(const QString& fileref) |
196 | { | 196 | { |
197 | open( fileref ); | 197 | open( fileref ); |
198 | } | 198 | } |
@@ -245,39 +245,39 @@ void TinyKate::slotClose( ) | |||
245 | delete dv->document(); | 245 | delete dv->document(); |
246 | viewCount--; | 246 | viewCount--; |
247 | if ((!viewCount) && (!shutDown)) slotNew(); | 247 | if ((!viewCount) && (!shutDown)) slotNew(); |
248 | } | 248 | } |
249 | 249 | ||
250 | void TinyKate::slotSave() { | 250 | void TinyKate::slotSave() { |
251 | // feel free to make this how you want | 251 | // feel free to make this how you want |
252 | if (currentView==0) return; | 252 | if (currentView==0) return; |
253 | 253 | ||
254 | // KateView *kv = (KateView*) currentView; | 254 | // KateView *kv = (KateView*) currentView; |
255 | KateDocument *kd = (KateDocument*) currentView->document(); | 255 | KateDocument *kd = (KateDocument*) currentView->document(); |
256 | // qDebug("saving file "+kd->docName()); | 256 | // qDebug("saving file "+kd->docName()); |
257 | if( kd->docName().isEmpty()) | 257 | if( kd->docName().isEmpty()) |
258 | slotSaveAs(); | 258 | slotSaveAs(); |
259 | else | 259 | else |
260 | kd->saveFile(); | 260 | kd->saveFile(); |
261 | // kv->save(); | 261 | // kv->save(); |
262 | // kd->saveFile(); | 262 | // kd->saveFile(); |
263 | } | 263 | } |
264 | 264 | ||
265 | void TinyKate::slotSaveAs() { | 265 | void TinyKate::slotSaveAs() { |
266 | if (currentView==0) return; | 266 | if (currentView==0) return; |
267 | KateDocument *kd = (KateDocument*) currentView->document(); | 267 | KateDocument *kd = (KateDocument*) currentView->document(); |
268 | 268 | ||
269 | QString filename=OFileDialog::getSaveFileName(OFileSelector::EXTENDED_ALL, | 269 | QString filename= Opie::OFileDialog::getSaveFileName(OFileSelector::EXTENDED_ALL, |
270 | QString::null); | 270 | QString::null); |
271 | if (!filename.isEmpty()) { | 271 | if (!filename.isEmpty()) { |
272 | qDebug("saving file "+filename); | 272 | qDebug("saving file "+filename); |
273 | QFileInfo fi(filename); | 273 | QFileInfo fi(filename); |
274 | QString filenamed = fi.fileName(); | 274 | QString filenamed = fi.fileName(); |
275 | kd->setDocFile( filename); | 275 | kd->setDocFile( filename); |
276 | kd->setDocName( filenamed); | 276 | kd->setDocName( filenamed); |
277 | kd->saveFile(); | 277 | kd->saveFile(); |
278 | // KTextEditor::View *dv = currentView; | 278 | // KTextEditor::View *dv = currentView; |
279 | // tabwidget->changeTab( dv, filenamed); | 279 | // tabwidget->changeTab( dv, filenamed); |
280 | // need to change tab label here | 280 | // need to change tab label here |
281 | } | 281 | } |
282 | 282 | ||
283 | } | 283 | } |