author | harlekin <harlekin> | 2003-04-10 20:10:36 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2003-04-10 20:10:36 (UTC) |
commit | 0740e2ef7132c53ebe29cc3b548647012bc75d05 (patch) (unidiff) | |
tree | eaf9a1fbdf73324743dc1a896e813c6e2675a513 | |
parent | dbbc4f5122cae1c6d64ce3e6793f4f588075a103 (diff) | |
download | opie-0740e2ef7132c53ebe29cc3b548647012bc75d05.zip opie-0740e2ef7132c53ebe29cc3b548647012bc75d05.tar.gz opie-0740e2ef7132c53ebe29cc3b548647012bc75d05.tar.bz2 |
goodbye qpemenubar and qpetoolbar ( both are depreciated ), using qmenubar now, and also the icons are in the menubar now as qtoolbutton which as side effect gives them the nice benefit if beeing centered to the right
-rw-r--r-- | noncore/apps/tinykate/tinykate.cpp | 78 | ||||
-rw-r--r-- | noncore/apps/tinykate/tinykate.h | 12 |
2 files changed, 46 insertions, 44 deletions
diff --git a/noncore/apps/tinykate/tinykate.cpp b/noncore/apps/tinykate/tinykate.cpp index a25f81f..694efc6 100644 --- a/noncore/apps/tinykate/tinykate.cpp +++ b/noncore/apps/tinykate/tinykate.cpp | |||
@@ -1,263 +1,271 @@ | |||
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 software; 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 <qpe/qpetoolbar.h> | 20 | #include <qtoolbutton.h> |
21 | #include <qpe/qpemenubar.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 | setToolBarsMovable(FALSE); | 44 | QMenuBar *mb = new QMenuBar( this ); |
45 | 45 | mb->setMargin( 0 ); | |
46 | QPEToolBar *bar = new QPEToolBar( this ); | ||
47 | bar->setHorizontalStretchable( TRUE ); | ||
48 | QPEMenuBar *mb = new QPEMenuBar( bar ); | ||
49 | mb->setMargin( 0 ); | ||
50 | 46 | ||
51 | tabwidget=new OTabWidget(this); | 47 | tabwidget=new OTabWidget(this); |
52 | setCentralWidget(tabwidget); | 48 | setCentralWidget(tabwidget); |
53 | connect(tabwidget,SIGNAL(currentChanged( QWidget *)),this,SLOT(slotCurrentChanged(QWidget *))); | 49 | connect(tabwidget,SIGNAL(currentChanged( QWidget *)),this,SLOT(slotCurrentChanged(QWidget *))); |
54 | 50 | ||
55 | //FILE ACTIONS | 51 | //FILE ACTIONS |
56 | QPopupMenu *popup = new QPopupMenu( this ); | 52 | QPopupMenu *popup = new QPopupMenu( this ); |
57 | 53 | ||
58 | // Action for creating a new document | 54 | // Action for creating a new document |
59 | 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 ); |
60 | a->addTo( popup ); | 56 | a->addTo( popup ); |
61 | connect(a, SIGNAL(activated()), this, SLOT(slotNew())); | 57 | connect(a, SIGNAL(activated()), this, SLOT(slotNew())); |
62 | 58 | ||
63 | // Action for opening an exisiting document | 59 | // Action for opening an exisiting document |
64 | 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 ); |
65 | a->addTo(popup); | 61 | a->addTo(popup); |
66 | connect(a, SIGNAL(activated()), this, SLOT(slotOpen())); | 62 | connect(a, SIGNAL(activated()), this, SLOT(slotOpen())); |
67 | 63 | ||
68 | 64 | ||
69 | // Action for saving document | 65 | // Action for saving document |
70 | 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 ); |
71 | a->addTo(popup); | 67 | a->addTo(popup); |
72 | connect(a, SIGNAL(activated()), this, SLOT(slotSave())); | 68 | connect(a, SIGNAL(activated()), this, SLOT(slotSave())); |
73 | 69 | ||
74 | // Action for saving document to a new name | 70 | // Action for saving document to a new name |
75 | 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 ); |
76 | a->addTo(popup); | 72 | a->addTo(popup); |
77 | connect(a, SIGNAL(activated()), this, SLOT(slotSaveAs())); | 73 | connect(a, SIGNAL(activated()), this, SLOT(slotSaveAs())); |
78 | 74 | ||
79 | // Action for closing the currently active document | 75 | // Action for closing the currently active document |
80 | 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 ); |
81 | a->addTo(popup); | 77 | a->addTo(popup); |
82 | connect(a, SIGNAL(activated()), this, SLOT(slotClose())); | 78 | connect(a, SIGNAL(activated()), this, SLOT(slotClose())); |
83 | 79 | ||
84 | 80 | ||
85 | mb->insertItem(tr("File"),popup); | 81 | mb->insertItem(tr("File"),popup); |
86 | 82 | ||
87 | //EDIT ACTIONS | 83 | //EDIT ACTIONS |
88 | 84 | ||
89 | // Action for cutting text | 85 | // Action for cutting text |
90 | editCut = new QAction( tr( "Cut" ), Resource::loadPixmap( "cut" ), QString::null, 0, this, 0 ); | 86 | editCut = new QToolButton( 0 ); |
91 | editCut->addTo( bar ); | 87 | editCut->setAutoRaise( true ); |
88 | editCut->setIconSet( Resource::loadPixmap( "cut" ) ); | ||
92 | 89 | ||
93 | // Action for Copying text | 90 | // Action for Copying text |
94 | editCopy = new QAction( tr( "Copy" ), Resource::loadPixmap( "copy" ), QString::null, 0, this, 0 ); | 91 | editCopy = new QToolButton( 0 ); |
95 | editCopy->addTo( bar ); | 92 | editCopy->setAutoRaise( true ); |
93 | editCopy->setIconSet( Resource::loadPixmap( "copy" ) ); | ||
96 | 94 | ||
97 | // Action for pasting text | 95 | // Action for pasting text |
98 | editPaste = new QAction( tr( "Paste" ), Resource::loadPixmap( "paste" ), QString::null, 0, this, 0 ); | 96 | editPaste = new QToolButton( 0 ); |
99 | editPaste->addTo( bar ); | 97 | editPaste->setAutoRaise( true ); |
100 | 98 | editPaste->setIconSet( Resource::loadPixmap( "paste" ) ); | |
101 | 99 | ||
102 | // Action for finding / replacing text | 100 | // Action for finding / replacing text |
103 | editFindReplace = new QAction( tr( "Find/Replace" ), Resource::loadPixmap("find"), QString::null, 0, this, 0 ); | 101 | editFindReplace = new QToolButton( 0 ); |
104 | editFindReplace->addTo( bar ); | 102 | editFindReplace->setAutoRaise( true ); |
103 | editFindReplace->setIconSet( Resource::loadPixmap("find") ); | ||
105 | 104 | ||
106 | // Action for undo | 105 | // Action for undo |
107 | editUndo = new QAction( tr( "Undo" ),Resource::loadPixmap( "undo" ) , QString::null, 0, this, 0 ); | 106 | editUndo = new QToolButton( 0 ); |
108 | editUndo->addTo( bar ); | 107 | editUndo->setAutoRaise( true ); |
108 | editUndo->setIconSet( Resource::loadPixmap( "undo" ) ); | ||
109 | 109 | ||
110 | // Action for redo | 110 | // Action for redo |
111 | editRedo = new QAction( tr( "Redo" ),Resource::loadPixmap( "redo" ) , QString::null, 0, this, 0 ); | 111 | editRedo = new QToolButton( 0 ); |
112 | editRedo->addTo( bar ); | 112 | editRedo->setAutoRaise( true ); |
113 | editRedo->setIconSet( Resource::loadPixmap( "redo" ) ); | ||
113 | 114 | ||
114 | //VIEW ACITONS | 115 | //VIEW ACITONS |
115 | popup = new QPopupMenu( this ); | 116 | popup = new QPopupMenu( this ); |
116 | 117 | ||
117 | viewIncFontSizes = new QAction( tr( "Font +" ), QString::null, 0, this, 0 ); | 118 | viewIncFontSizes = new QAction( tr( "Font +" ), QString::null, 0, this, 0 ); |
118 | viewIncFontSizes->addTo( popup ); | 119 | viewIncFontSizes->addTo( popup ); |
119 | 120 | ||
120 | viewDecFontSizes = new QAction( tr( "Font -" ), QString::null, 0, this, 0 ); | 121 | viewDecFontSizes = new QAction( tr( "Font -" ), QString::null, 0, this, 0 ); |
121 | viewDecFontSizes->addTo( popup ); | 122 | viewDecFontSizes->addTo( popup ); |
122 | 123 | ||
123 | mb->insertItem(tr("View"),popup); | 124 | mb->insertItem(tr("View"),popup); |
124 | 125 | ||
126 | popup = new QPopupMenu( this ); | ||
127 | mb->insertItem(tr("Utils"),popup); | ||
125 | 128 | ||
126 | 129 | ||
127 | popup = new QPopupMenu( this ); | 130 | mb->insertItem( editCut ); |
128 | mb->insertItem(tr("Utils"),popup); | 131 | mb->insertItem( editCopy ); |
132 | mb->insertItem( editPaste ); | ||
133 | mb->insertItem( editFindReplace ); | ||
134 | mb->insertItem( editUndo ); | ||
135 | mb->insertItem( editRedo ); | ||
136 | |||
129 | 137 | ||
130 | //Highlight management | 138 | //Highlight management |
131 | hlmenu=new QPopupMenu(this); | 139 | hlmenu=new QPopupMenu(this); |
132 | HlManager *hlm=HlManager::self(); | 140 | HlManager *hlm=HlManager::self(); |
133 | for (int i=0;i<hlm->highlights();i++) | 141 | for (int i=0;i<hlm->highlights();i++) |
134 | { | 142 | { |
135 | hlmenu->insertItem(hlm->hlName(i),i); | 143 | hlmenu->insertItem(hlm->hlName(i),i); |
136 | } | 144 | } |
137 | popup->insertItem(tr("Highlighting"),hlmenu); | 145 | popup->insertItem(tr("Highlighting"),hlmenu); |
138 | 146 | ||
139 | 147 | ||
140 | utilSettings = new QAction( tr( "Settings" ), QString::null, 0, this, 0 ); | 148 | utilSettings = new QAction( tr( "Settings" ), QString::null, 0, this, 0 ); |
141 | utilSettings->addTo( popup); | 149 | utilSettings->addTo( popup); |
142 | 150 | ||
143 | if( qApp->argc() > 1) open(qApp->argv()[1]); | 151 | if( qApp->argc() > 1) open(qApp->argv()[1]); |
144 | else slotNew(); | 152 | else slotNew(); |
145 | 153 | ||
146 | } | 154 | } |
147 | 155 | ||
148 | TinyKate::~TinyKate( ) | 156 | TinyKate::~TinyKate( ) |
149 | { | 157 | { |
150 | qWarning("TinyKate destructor\n"); | 158 | qWarning("TinyKate destructor\n"); |
151 | if( KGlobal::config() != 0 ) { | 159 | if( KGlobal::config() != 0 ) { |
152 | qWarning("deleting KateConfig object..\n"); | 160 | qWarning("deleting KateConfig object..\n"); |
153 | delete KGlobal::config(); | 161 | delete KGlobal::config(); |
154 | } | 162 | } |
155 | } | 163 | } |
156 | 164 | ||
157 | void TinyKate::slotOpen( ) | 165 | void TinyKate::slotOpen( ) |
158 | { | 166 | { |
159 | QString filename = OFileDialog::getOpenFileName( OFileSelector::EXTENDED_ALL, | 167 | QString filename = OFileDialog::getOpenFileName( OFileSelector::EXTENDED_ALL, |
160 | QPEApplication::documentDir()); | 168 | QPEApplication::documentDir()); |
161 | if (!filename.isEmpty()) { | 169 | if (!filename.isEmpty()) { |
162 | open(filename); | 170 | open(filename); |
163 | } | 171 | } |
164 | } | 172 | } |
165 | 173 | ||
166 | void TinyKate::open(const QString & filename) | 174 | void TinyKate::open(const QString & filename) |
167 | { | 175 | { |
168 | KateDocument *kd= new KateDocument(false, false, this,0,this); | 176 | KateDocument *kd= new KateDocument(false, false, this,0,this); |
169 | KTextEditor::View *kv; | 177 | KTextEditor::View *kv; |
170 | QFileInfo fi(filename); | 178 | QFileInfo fi(filename); |
171 | QString filenamed = fi.fileName(); | 179 | QString filenamed = fi.fileName(); |
172 | tabwidget->addTab(kv=kd->createView(tabwidget,"bLAH"),"tinykate/tinykate", filenamed ); | 180 | tabwidget->addTab(kv=kd->createView(tabwidget,"bLAH"),"tinykate/tinykate", filenamed ); |
173 | qDebug(filename); | 181 | qDebug(filename); |
174 | 182 | ||
175 | kd->setDocName( filenamed); | 183 | kd->setDocName( filenamed); |
176 | kd->open( filename ); | 184 | kd->open( filename ); |
177 | viewCount++; | 185 | viewCount++; |
178 | } | 186 | } |
179 | 187 | ||
180 | void TinyKate::slotCurrentChanged( QWidget * view) | 188 | void TinyKate::slotCurrentChanged( QWidget * view) |
181 | { | 189 | { |
182 | if (currentView) { | 190 | if (currentView) { |
183 | 191 | ||
184 | disconnect(editCopy,SIGNAL(activated()),currentView,SLOT(copy())); | 192 | disconnect(editCopy,SIGNAL(activated()),currentView,SLOT(copy())); |
185 | disconnect(editCut,SIGNAL(activated()),currentView,SLOT(cut())); | 193 | disconnect(editCut,SIGNAL(activated()),currentView,SLOT(cut())); |
186 | disconnect(editPaste,SIGNAL(activated()),currentView,SLOT(paste())); | 194 | disconnect(editPaste,SIGNAL(activated()),currentView,SLOT(paste())); |
187 | disconnect(editUndo,SIGNAL(activated()),currentView,SLOT(undo())); | 195 | disconnect(editUndo,SIGNAL(activated()),currentView,SLOT(undo())); |
188 | disconnect(editRedo,SIGNAL(activated()),currentView,SLOT(redo())); | 196 | disconnect(editRedo,SIGNAL(activated()),currentView,SLOT(redo())); |
189 | disconnect(viewIncFontSizes,SIGNAL(activated()), currentView,SLOT(slotIncFontSizes())); | 197 | disconnect(viewIncFontSizes,SIGNAL(activated()), currentView,SLOT(slotIncFontSizes())); |
190 | disconnect(viewDecFontSizes,SIGNAL(activated()), currentView,SLOT(slotDecFontSizes())); | 198 | disconnect(viewDecFontSizes,SIGNAL(activated()), currentView,SLOT(slotDecFontSizes())); |
191 | disconnect(hlmenu,SIGNAL(activated(int)), currentView,SLOT(setHl(int))); | 199 | disconnect(hlmenu,SIGNAL(activated(int)), currentView,SLOT(setHl(int))); |
192 | disconnect(utilSettings,SIGNAL(activated()), currentView,SLOT(configDialog())); | 200 | disconnect(utilSettings,SIGNAL(activated()), currentView,SLOT(configDialog())); |
193 | } | 201 | } |
194 | 202 | ||
195 | currentView=(KTextEditor::View*)view; | 203 | currentView=(KTextEditor::View*)view; |
196 | 204 | ||
197 | connect(editCopy,SIGNAL(activated()),currentView,SLOT(copy())); | 205 | connect(editCopy,SIGNAL(clicked()),currentView,SLOT(copy())); |
198 | connect(editCut,SIGNAL(activated()),currentView,SLOT(cut())); | 206 | connect(editCut,SIGNAL(clicked()),currentView,SLOT(cut())); |
199 | connect(editPaste,SIGNAL(activated()),currentView,SLOT(paste())); | 207 | connect(editPaste,SIGNAL(clicked()),currentView,SLOT(paste())); |
200 | connect(editUndo,SIGNAL(activated()),currentView,SLOT(undo())); | 208 | connect(editUndo,SIGNAL(clicked()),currentView,SLOT(undo())); |
201 | connect(editRedo,SIGNAL(activated()),currentView,SLOT(redo())); | 209 | connect(editRedo,SIGNAL(clicked()),currentView,SLOT(redo())); |
202 | connect(viewIncFontSizes,SIGNAL(activated()), currentView,SLOT(slotIncFontSizes())); | 210 | connect(viewIncFontSizes,SIGNAL(activated()), currentView,SLOT(slotIncFontSizes())); |
203 | connect(viewDecFontSizes,SIGNAL(activated()), currentView,SLOT(slotDecFontSizes())); | 211 | connect(viewDecFontSizes,SIGNAL(activated()), currentView,SLOT(slotDecFontSizes())); |
204 | connect(hlmenu,SIGNAL(activated(int)), currentView,SLOT(setHl(int))); | 212 | connect(hlmenu,SIGNAL(activated(int)), currentView,SLOT(setHl(int))); |
205 | connect(utilSettings,SIGNAL(activated()), currentView,SLOT(configDialog())); | 213 | connect(utilSettings,SIGNAL(activated()), currentView,SLOT(configDialog())); |
206 | 214 | ||
207 | } | 215 | } |
208 | 216 | ||
209 | void TinyKate::slotNew( ) | 217 | void TinyKate::slotNew( ) |
210 | { | 218 | { |
211 | KateDocument *kd= new KateDocument(false, false, this,0,this); | 219 | KateDocument *kd= new KateDocument(false, false, this,0,this); |
212 | KTextEditor::View *kv; | 220 | KTextEditor::View *kv; |
213 | tabwidget->addTab(kv=kd->createView(tabwidget,"BLAH"), | 221 | tabwidget->addTab(kv=kd->createView(tabwidget,"BLAH"), |
214 | "tinykate/tinykate", | 222 | "tinykate/tinykate", |
215 | tr("Unnamed %1").arg(nextUnnamed++)); | 223 | tr("Unnamed %1").arg(nextUnnamed++)); |
216 | viewCount++; | 224 | viewCount++; |
217 | } | 225 | } |
218 | 226 | ||
219 | void TinyKate::slotClose( ) | 227 | void TinyKate::slotClose( ) |
220 | { | 228 | { |
221 | if (currentView==0) return; | 229 | if (currentView==0) return; |
222 | KTextEditor::View *dv=currentView; | 230 | KTextEditor::View *dv=currentView; |
223 | currentView=0; | 231 | currentView=0; |
224 | tabwidget->removePage(dv); | 232 | tabwidget->removePage(dv); |
225 | delete dv->document(); | 233 | delete dv->document(); |
226 | viewCount--; | 234 | viewCount--; |
227 | if (!viewCount) slotNew(); | 235 | if (!viewCount) slotNew(); |
228 | } | 236 | } |
229 | 237 | ||
230 | void TinyKate::slotSave() { | 238 | void TinyKate::slotSave() { |
231 | // feel free to make this how you want | 239 | // feel free to make this how you want |
232 | if (currentView==0) return; | 240 | if (currentView==0) return; |
233 | 241 | ||
234 | // KateView *kv = (KateView*) currentView; | 242 | // KateView *kv = (KateView*) currentView; |
235 | KateDocument *kd = (KateDocument*) currentView->document(); | 243 | KateDocument *kd = (KateDocument*) currentView->document(); |
236 | // qDebug("saving file "+kd->docName()); | 244 | // qDebug("saving file "+kd->docName()); |
237 | if( kd->docName().isEmpty()) | 245 | if( kd->docName().isEmpty()) |
238 | slotSaveAs(); | 246 | slotSaveAs(); |
239 | else | 247 | else |
240 | kd->saveFile(); | 248 | kd->saveFile(); |
241 | // kv->save(); | 249 | // kv->save(); |
242 | // kd->saveFile(); | 250 | // kd->saveFile(); |
243 | } | 251 | } |
244 | 252 | ||
245 | void TinyKate::slotSaveAs() { | 253 | void TinyKate::slotSaveAs() { |
246 | if (currentView==0) return; | 254 | if (currentView==0) return; |
247 | KateDocument *kd = (KateDocument*) currentView->document(); | 255 | KateDocument *kd = (KateDocument*) currentView->document(); |
248 | 256 | ||
249 | QString filename=OFileDialog::getSaveFileName(OFileSelector::EXTENDED_ALL, | 257 | QString filename=OFileDialog::getSaveFileName(OFileSelector::EXTENDED_ALL, |
250 | QPEApplication::documentDir()); | 258 | QPEApplication::documentDir()); |
251 | if (!filename.isEmpty()) { | 259 | if (!filename.isEmpty()) { |
252 | qDebug("saving file "+filename); | 260 | qDebug("saving file "+filename); |
253 | QFileInfo fi(filename); | 261 | QFileInfo fi(filename); |
254 | QString filenamed = fi.fileName(); | 262 | QString filenamed = fi.fileName(); |
255 | kd->setDocFile( filename); | 263 | kd->setDocFile( filename); |
256 | kd->setDocName( filenamed); | 264 | kd->setDocName( filenamed); |
257 | kd->saveFile(); | 265 | kd->saveFile(); |
258 | // KTextEditor::View *dv = currentView; | 266 | // KTextEditor::View *dv = currentView; |
259 | // tabwidget->changeTab( dv, filenamed); | 267 | // tabwidget->changeTab( dv, filenamed); |
260 | // need to change tab label here | 268 | // need to change tab label here |
261 | } | 269 | } |
262 | 270 | ||
263 | } | 271 | } |
diff --git a/noncore/apps/tinykate/tinykate.h b/noncore/apps/tinykate/tinykate.h index bb32f98..cdd8f43 100644 --- a/noncore/apps/tinykate/tinykate.h +++ b/noncore/apps/tinykate/tinykate.h | |||
@@ -1,68 +1,62 @@ | |||
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 QAction; | 27 | class QAction; |
27 | class QPopupMenu; | 28 | class QPopupMenu; |
28 | 29 | ||
29 | class TinyKate : public QMainWindow | 30 | class TinyKate : public QMainWindow |
30 | { | 31 | { |
31 | Q_OBJECT | 32 | Q_OBJECT |
32 | public: | 33 | public: |
33 | TinyKate( QWidget *parent=0, const char *name=0, WFlags f = 0); | 34 | TinyKate( QWidget *parent=0, const char *name=0, WFlags f = 0); |
34 | ~TinyKate( ); | 35 | ~TinyKate( ); |
35 | 36 | ||
36 | public slots: | 37 | public slots: |
37 | void slotNew(); | 38 | void slotNew(); |
38 | 39 | ||
39 | protected slots: | 40 | protected slots: |
40 | void slotOpen(); | 41 | void slotOpen(); |
41 | void slotClose(); | 42 | void slotClose(); |
42 | void slotCurrentChanged(QWidget *); | 43 | void slotCurrentChanged(QWidget *); |
43 | void slotSave(); | 44 | void slotSave(); |
44 | void slotSaveAs(); | 45 | void slotSaveAs(); |
45 | protected: | 46 | protected: |
46 | void open(const QString&); | 47 | void open(const QString&); |
47 | private: | 48 | private: |
48 | QString currentFileName; | 49 | QString currentFileName; |
49 | OTabWidget *tabwidget; | 50 | OTabWidget *tabwidget; |
50 | KTextEditor::View *currentView; | 51 | KTextEditor::View *currentView; |
51 | 52 | ||
52 | QAction *editCopy; | 53 | QToolButton *editCopy, *editCut, *editPaste, *editUndo, *editRedo, *editFindReplace; |
53 | QAction *editCut; | 54 | QAction *viewIncFontSizes, *viewDecFontSizes, *utilSettings; |
54 | QAction *editPaste; | ||
55 | QAction *editUndo; | ||
56 | QAction *editRedo; | ||
57 | QAction *editFindReplace; | ||
58 | QAction *viewIncFontSizes; | ||
59 | QAction *viewDecFontSizes; | ||
60 | QAction *utilSettings; | ||
61 | 55 | ||
62 | QPopupMenu *hlmenu; | 56 | QPopupMenu *hlmenu; |
63 | uint nextUnnamed; | 57 | uint nextUnnamed; |
64 | uint viewCount; | 58 | uint viewCount; |
65 | }; | 59 | }; |
66 | 60 | ||
67 | 61 | ||
68 | #endif // __TINYKATE_H__ | 62 | #endif // __TINYKATE_H__ |