author | ar <ar> | 2004-06-20 21:17:00 (UTC) |
---|---|---|
committer | ar <ar> | 2004-06-20 21:17:00 (UTC) |
commit | 526031c34fff4e789b05fddbd7effe83ef057361 (patch) (unidiff) | |
tree | 23146566d3d27ba9648d5a8e0500d6b41c6ac9f9 | |
parent | f12be4d4ffaf6b5542b270c7d18fbb7141711309 (diff) | |
download | opie-526031c34fff4e789b05fddbd7effe83ef057361.zip opie-526031c34fff4e789b05fddbd7effe83ef057361.tar.gz opie-526031c34fff4e789b05fddbd7effe83ef057361.tar.bz2 |
- BUGFIX: 0001291 - opie tinykate does not open .desktop files
-rw-r--r-- | noncore/apps/tinykate/mainwindow/tinykate.cpp | 373 | ||||
-rw-r--r-- | noncore/apps/tinykate/mainwindow/tinykate.h | 4 |
2 files changed, 202 insertions, 175 deletions
diff --git a/noncore/apps/tinykate/mainwindow/tinykate.cpp b/noncore/apps/tinykate/mainwindow/tinykate.cpp index 9865c35..30c07fc 100644 --- a/noncore/apps/tinykate/mainwindow/tinykate.cpp +++ b/noncore/apps/tinykate/mainwindow/tinykate.cpp | |||
@@ -25,260 +25,287 @@ | |||
25 | #include <opie2/ofiledialog.h> | 25 | #include <opie2/ofiledialog.h> |
26 | #include <qpe/resource.h> | 26 | #include <qpe/resource.h> |
27 | #include <qpe/qpeapplication.h> | 27 | #include <qpe/qpeapplication.h> |
28 | 28 | ||
29 | /* QT */ | 29 | /* QT */ |
30 | #include <qaction.h> | 30 | #include <qaction.h> |
31 | #include <qtoolbutton.h> | 31 | #include <qtoolbutton.h> |
32 | #include <qmenubar.h> | 32 | #include <qmenubar.h> |
33 | #include <qmessagebox.h> | ||
33 | 34 | ||
34 | 35 | ||
35 | using namespace Opie::Ui; | 36 | using namespace Opie::Ui; |
36 | TinyKate::TinyKate( QWidget *parent, const char *name, WFlags f) : | 37 | TinyKate::TinyKate( QWidget *parent, const char *name, WFlags f) : |
37 | QMainWindow( parent, name, f ) | 38 | QMainWindow( parent, name, f ) |
38 | { | 39 | { |
39 | shutDown=false; | 40 | shutDown=false; |
40 | nextUnnamed=0; | 41 | nextUnnamed=0; |
41 | currentView=0; | 42 | currentView=0; |
42 | viewCount=0; | 43 | viewCount=0; |
43 | setCaption(tr("TinyKATE")); | 44 | setCaption(tr("TinyKATE")); |
44 | KGlobal::setAppName("TinyKATE"); | 45 | KGlobal::setAppName("TinyKATE"); |
45 | 46 | ||
46 | QMenuBar *mb = new QMenuBar( this ); | 47 | QMenuBar *mb = new QMenuBar( this ); |
47 | mb->setMargin( 0 ); | 48 | mb->setMargin( 0 ); |
48 | 49 | ||
49 | tabwidget=new OTabWidget(this); | 50 | tabwidget=new OTabWidget(this); |
50 | setCentralWidget(tabwidget); | 51 | setCentralWidget(tabwidget); |
51 | connect(tabwidget,SIGNAL(currentChanged(QWidget*)),this,SLOT(slotCurrentChanged(QWidget*))); | 52 | connect(tabwidget,SIGNAL(currentChanged(QWidget*)),this,SLOT(slotCurrentChanged(QWidget*))); |
52 | 53 | ||
53 | //FILE ACTIONS | 54 | //FILE ACTIONS |
54 | QPopupMenu *popup = new QPopupMenu( this ); | 55 | QPopupMenu *popup = new QPopupMenu( this ); |
55 | 56 | ||
56 | // Action for creating a new document | 57 | // Action for creating a new document |
57 | QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); | 58 | QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); |
58 | a->addTo( popup ); | 59 | a->addTo( popup ); |
59 | connect(a, SIGNAL(activated()), this, SLOT(slotNew())); | 60 | connect(a, SIGNAL(activated()), this, SLOT(slotNew())); |
60 | 61 | ||
61 | // Action for opening an exisiting document | 62 | // Action for opening an exisiting document |
62 | a = new QAction( tr( "Open" ),Resource::loadPixmap( "fileopen" ) , QString::null, 0, this, 0 ); | 63 | a = new QAction( tr( "Open" ),Resource::loadPixmap( "fileopen" ) , QString::null, 0, this, 0 ); |
63 | a->addTo(popup); | 64 | a->addTo(popup); |
64 | connect(a, SIGNAL(activated()), this, SLOT(slotOpen())); | 65 | connect(a, SIGNAL(activated()), this, SLOT(slotOpen())); |
65 | 66 | ||
66 | 67 | ||
67 | // Action for saving document | 68 | // Action for saving document |
68 | a = new QAction( tr( "Save" ), Resource::loadPixmap( "save" ) , QString::null, 0, this, 0 ); | 69 | a = new QAction( tr( "Save" ), Resource::loadPixmap( "save" ) , QString::null, 0, this, 0 ); |
69 | a->addTo(popup); | 70 | a->addTo(popup); |
70 | connect(a, SIGNAL(activated()), this, SLOT(slotSave())); | 71 | connect(a, SIGNAL(activated()), this, SLOT(slotSave())); |
71 | 72 | ||
72 | // Action for saving document to a new name | 73 | // Action for saving document to a new name |
73 | a = new QAction( tr( "Save As" ),Resource::loadPixmap( "save" ) , QString::null, 0, this, 0 ); | 74 | a = new QAction( tr( "Save As" ),Resource::loadPixmap( "save" ) , QString::null, 0, this, 0 ); |
74 | a->addTo(popup); | 75 | a->addTo(popup); |
75 | connect(a, SIGNAL(activated()), this, SLOT(slotSaveAs())); | 76 | connect(a, SIGNAL(activated()), this, SLOT(slotSaveAs())); |
76 | 77 | ||
77 | // Action for closing the currently active document | 78 | // Action for closing the currently active document |
78 | a = new QAction( tr( "Close" ), Resource::loadPixmap( "quit_icon" ) , QString::null, 0, this, 0 ); | 79 | a = new QAction( tr( "Close" ), Resource::loadPixmap( "quit_icon" ) , QString::null, 0, this, 0 ); |
79 | a->addTo(popup); | 80 | a->addTo(popup); |
80 | connect(a, SIGNAL(activated()), this, SLOT(slotClose())); | 81 | connect(a, SIGNAL(activated()), this, SLOT(slotClose())); |
81 | 82 | ||
82 | 83 | ||
83 | mb->insertItem(tr("File"),popup); | 84 | mb->insertItem(tr("File"),popup); |
84 | 85 | ||
85 | //EDIT ACTIONS | 86 | //EDIT ACTIONS |
86 | 87 | ||
87 | // Action for cutting text | 88 | // Action for cutting text |
88 | editCut = new QToolButton( 0 ); | 89 | editCut = new QToolButton( 0 ); |
89 | editCut->setAutoRaise( true ); | 90 | editCut->setAutoRaise( true ); |
90 | editCut->setIconSet( Resource::loadPixmap( "cut" ) ); | 91 | editCut->setIconSet( Resource::loadPixmap( "cut" ) ); |
91 | 92 | ||
92 | // Action for Copying text | 93 | // Action for Copying text |
93 | editCopy = new QToolButton( 0 ); | 94 | editCopy = new QToolButton( 0 ); |
94 | editCopy->setAutoRaise( true ); | 95 | editCopy->setAutoRaise( true ); |
95 | editCopy->setIconSet( Resource::loadPixmap( "copy" ) ); | 96 | editCopy->setIconSet( Resource::loadPixmap( "copy" ) ); |
96 | 97 | ||
97 | // Action for pasting text | 98 | // Action for pasting text |
98 | editPaste = new QToolButton( 0 ); | 99 | editPaste = new QToolButton( 0 ); |
99 | editPaste->setAutoRaise( true ); | 100 | editPaste->setAutoRaise( true ); |
100 | editPaste->setIconSet( Resource::loadPixmap( "paste" ) ); | 101 | editPaste->setIconSet( Resource::loadPixmap( "paste" ) ); |
101 | 102 | ||
102 | // Action for finding / replacing text | 103 | // Action for finding / replacing text |
103 | editFindReplace = new QToolButton( 0 ); | 104 | editFindReplace = new QToolButton( 0 ); |
104 | editFindReplace->setAutoRaise( true ); | 105 | editFindReplace->setAutoRaise( true ); |
105 | editFindReplace->setIconSet( Resource::loadPixmap("find") ); | 106 | editFindReplace->setIconSet( Resource::loadPixmap("find") ); |
106 | 107 | ||
107 | // Action for undo | 108 | // Action for undo |
108 | editUndo = new QToolButton( 0 ); | 109 | editUndo = new QToolButton( 0 ); |
109 | editUndo->setAutoRaise( true ); | 110 | editUndo->setAutoRaise( true ); |
110 | editUndo->setIconSet( Resource::loadPixmap( "undo" ) ); | 111 | editUndo->setIconSet( Resource::loadPixmap( "undo" ) ); |
111 | 112 | ||
112 | // Action for redo | 113 | // Action for redo |
113 | editRedo = new QToolButton( 0 ); | 114 | editRedo = new QToolButton( 0 ); |
114 | editRedo->setAutoRaise( true ); | 115 | editRedo->setAutoRaise( true ); |
115 | editRedo->setIconSet( Resource::loadPixmap( "redo" ) ); | 116 | editRedo->setIconSet( Resource::loadPixmap( "redo" ) ); |
116 | 117 | ||
117 | //VIEW ACITONS | 118 | //VIEW ACITONS |
118 | popup = new QPopupMenu( this ); | 119 | popup = new QPopupMenu( this ); |
119 | 120 | ||
120 | viewIncFontSizes = new QAction( tr( "Font +" ), QString::null, 0, this, 0 ); | 121 | viewIncFontSizes = new QAction( tr( "Font +" ), QString::null, 0, this, 0 ); |
121 | viewIncFontSizes->addTo( popup ); | 122 | viewIncFontSizes->addTo( popup ); |
122 | 123 | ||
123 | viewDecFontSizes = new QAction( tr( "Font -" ), QString::null, 0, this, 0 ); | 124 | viewDecFontSizes = new QAction( tr( "Font -" ), QString::null, 0, this, 0 ); |
124 | viewDecFontSizes->addTo( popup ); | 125 | viewDecFontSizes->addTo( popup ); |
125 | 126 | ||
126 | mb->insertItem(tr("View"),popup); | 127 | mb->insertItem(tr("View"),popup); |
127 | 128 | ||
128 | popup = new QPopupMenu( this ); | 129 | popup = new QPopupMenu( this ); |
129 | mb->insertItem(tr("Utils"),popup); | 130 | mb->insertItem(tr("Utils"),popup); |
130 | 131 | ||
131 | 132 | ||
132 | mb->insertItem( editCut ); | 133 | mb->insertItem( editCut ); |
133 | mb->insertItem( editCopy ); | 134 | mb->insertItem( editCopy ); |
134 | mb->insertItem( editPaste ); | 135 | mb->insertItem( editPaste ); |
135 | mb->insertItem( editFindReplace ); | 136 | mb->insertItem( editFindReplace ); |
136 | mb->insertItem( editUndo ); | 137 | mb->insertItem( editUndo ); |
137 | mb->insertItem( editRedo ); | 138 | mb->insertItem( editRedo ); |
138 | 139 | ||
139 | 140 | ||
140 | //Highlight management | 141 | //Highlight management |
141 | hlmenu=new QPopupMenu(this); | 142 | hlmenu=new QPopupMenu(this); |
142 | HlManager *hlm=HlManager::self(); | 143 | HlManager *hlm=HlManager::self(); |
143 | for (int i=0;i<hlm->highlights();i++) | 144 | for (int i=0;i<hlm->highlights();i++) |
144 | { | 145 | { |
145 | hlmenu->insertItem(hlm->hlName(i),i); | 146 | hlmenu->insertItem(hlm->hlName(i),i); |
146 | } | 147 | } |
147 | popup->insertItem(tr("Highlighting"),hlmenu); | 148 | popup->insertItem(tr("Highlighting"),hlmenu); |
148 | 149 | ||
149 | 150 | ||
150 | utilSettings = new QAction( tr( "Settings" ), QString::null, 0, this, 0 ); | 151 | utilSettings = new QAction( tr( "Settings" ), QString::null, 0, this, 0 ); |
151 | utilSettings->addTo( popup); | 152 | utilSettings->addTo( popup); |
152 | 153 | ||
153 | if( qApp->argc() > 1) open(qApp->argv()[1]); | 154 | if( qApp->argc() > 1) open(qApp->argv()[1]); |
154 | else slotNew(); | 155 | else slotNew(); |
155 | 156 | ||
156 | } | 157 | } |
157 | 158 | ||
158 | TinyKate::~TinyKate( ) | 159 | TinyKate::~TinyKate( ) |
159 | { | 160 | { |
160 | owarn << "TinyKate destructor\n" << oendl; | 161 | owarn << "TinyKate destructor\n" << oendl; |
161 | 162 | ||
162 | shutDown=true; | 163 | shutDown=true; |
163 | while (currentView!=0) { | 164 | while (currentView!=0) |
164 | slotClose(); | 165 | { |
165 | } | 166 | slotClose(); |
166 | 167 | } | |
167 | if( KGlobal::config() != 0 ) { | 168 | |
168 | owarn << "deleting KateConfig object..\n" << oendl; | 169 | if( KGlobal::config() != 0 ) |
169 | delete KGlobal::config(); | 170 | { |
170 | } | 171 | owarn << "deleting KateConfig object..\n" << oendl; |
172 | delete KGlobal::config(); | ||
173 | } | ||
171 | } | 174 | } |
172 | 175 | ||
173 | void TinyKate::slotOpen( ) | 176 | void TinyKate::slotOpen( ) |
174 | { | 177 | { |
175 | QString filename = OFileDialog::getOpenFileName( OFileSelector::EXTENDED_ALL, | 178 | QString filename = OFileDialog::getOpenFileName( OFileSelector::EXTENDED_ALL, |
176 | QString::null); | 179 | QString::null); |
177 | if (!filename.isEmpty()) { | 180 | if (!filename.isEmpty()) |
178 | open(filename); | 181 | { |
179 | } | 182 | open(filename); |
183 | } | ||
180 | } | 184 | } |
181 | 185 | ||
182 | void TinyKate::open(const QString & filename) | 186 | void TinyKate::open(const QString & filename) |
183 | { | 187 | { |
184 | KateDocument *kd= new KateDocument(false, false, this,0,this); | 188 | KateDocument *kd= new KateDocument(false, false, this,0,this); |
185 | KTextEditor::View *kv; | 189 | KTextEditor::View *kv; |
186 | QFileInfo fi(filename); | 190 | QString realFileName; |
187 | QString filenamed = fi.fileName(); | 191 | //check if filename is a .desktop file |
192 | if ( filename.find( ".desktop", 0, true ) ) | ||
193 | { | ||
194 | switch ( QMessageBox::warning( this, tr( "TinyKATE" ), | ||
195 | tr("TinyKATE has detected<BR>you selected a <B>.desktop</B> file.<BR>Open <B>.desktop</B> file or <B>linked</B> file?" ), | ||
196 | tr(".desktop File"), | ||
197 | tr("Linked Document"), 0, 1, 1 ) ) | ||
198 | { | ||
199 | case 0: //desktop | ||
200 | realFileName = filename; | ||
201 | break; | ||
202 | case 1: //linked | ||
203 | DocLnk docLnk( filename ); | ||
204 | realFileName = docLnk.file(); | ||
205 | break; | ||
206 | }; | ||
207 | } | ||
208 | |||
209 | QFileInfo fileInfo( realFileName ); | ||
210 | QString filenamed = fileInfo.fileName(); | ||
188 | tabwidget->addTab(kv=kd->createView(tabwidget,"bLAH"),"tinykate/tinykate", filenamed ); | 211 | tabwidget->addTab(kv=kd->createView(tabwidget,"bLAH"),"tinykate/tinykate", filenamed ); |
189 | odebug << filename << oendl; | 212 | odebug << realFileName << oendl; |
190 | 213 | ||
191 | kd->setDocName( filenamed); | 214 | kd->setDocName( filenamed); |
192 | kd->open( filename ); | 215 | kd->open( realFileName ); |
193 | viewCount++; | 216 | viewCount++; |
194 | } | 217 | } |
195 | 218 | ||
196 | void TinyKate::setDocument(const QString& fileref) | 219 | void TinyKate::setDocument(const QString& fileref) |
197 | { | 220 | { |
198 | open( fileref ); | 221 | open( fileref ); |
199 | } | 222 | } |
200 | 223 | ||
201 | void TinyKate::slotCurrentChanged( QWidget * view) | 224 | void TinyKate::slotCurrentChanged( QWidget * view) |
202 | { | 225 | { |
203 | if (currentView) { | 226 | if (currentView) |
204 | 227 | { | |
205 | disconnect(editCopy,SIGNAL(activated()),currentView,SLOT(copy())); | 228 | |
206 | disconnect(editCut,SIGNAL(activated()),currentView,SLOT(cut())); | 229 | disconnect(editCopy,SIGNAL(activated()),currentView,SLOT(copy())); |
207 | disconnect(editPaste,SIGNAL(activated()),currentView,SLOT(paste())); | 230 | disconnect(editCut,SIGNAL(activated()),currentView,SLOT(cut())); |
208 | disconnect(editUndo,SIGNAL(activated()),currentView,SLOT(undo())); | 231 | disconnect(editPaste,SIGNAL(activated()),currentView,SLOT(paste())); |
209 | disconnect(editRedo,SIGNAL(activated()),currentView,SLOT(redo())); | 232 | disconnect(editUndo,SIGNAL(activated()),currentView,SLOT(undo())); |
210 | disconnect(viewIncFontSizes,SIGNAL(activated()), currentView,SLOT(slotIncFontSizes())); | 233 | disconnect(editRedo,SIGNAL(activated()),currentView,SLOT(redo())); |
211 | disconnect(viewDecFontSizes,SIGNAL(activated()), currentView,SLOT(slotDecFontSizes())); | 234 | disconnect(viewIncFontSizes,SIGNAL(activated()), currentView,SLOT(slotIncFontSizes())); |
212 | disconnect(hlmenu,SIGNAL(activated(int)), currentView,SLOT(setHl(int))); | 235 | disconnect(viewDecFontSizes,SIGNAL(activated()), currentView,SLOT(slotDecFontSizes())); |
213 | disconnect(utilSettings,SIGNAL(activated()), currentView,SLOT(configDialog())); | 236 | disconnect(hlmenu,SIGNAL(activated(int)), currentView,SLOT(setHl(int))); |
214 | } | 237 | disconnect(utilSettings,SIGNAL(activated()), currentView,SLOT(configDialog())); |
215 | 238 | } | |
216 | currentView=(KTextEditor::View*)view; | 239 | |
217 | 240 | currentView=(KTextEditor::View*)view; | |
218 | connect(editCopy,SIGNAL(clicked()),currentView,SLOT(copy())); | 241 | |
219 | connect(editCut,SIGNAL(clicked()),currentView,SLOT(cut())); | 242 | connect(editCopy,SIGNAL(clicked()),currentView,SLOT(copy())); |
220 | connect(editPaste,SIGNAL(clicked()),currentView,SLOT(paste())); | 243 | connect(editCut,SIGNAL(clicked()),currentView,SLOT(cut())); |
221 | connect(editUndo,SIGNAL(clicked()),currentView,SLOT(undo())); | 244 | connect(editPaste,SIGNAL(clicked()),currentView,SLOT(paste())); |
222 | connect(editRedo,SIGNAL(clicked()),currentView,SLOT(redo())); | 245 | connect(editUndo,SIGNAL(clicked()),currentView,SLOT(undo())); |
223 | connect(viewIncFontSizes,SIGNAL(activated()), currentView,SLOT(slotIncFontSizes())); | 246 | connect(editRedo,SIGNAL(clicked()),currentView,SLOT(redo())); |
224 | connect(viewDecFontSizes,SIGNAL(activated()), currentView,SLOT(slotDecFontSizes())); | 247 | connect(viewIncFontSizes,SIGNAL(activated()), currentView,SLOT(slotIncFontSizes())); |
225 | connect(hlmenu,SIGNAL(activated(int)), currentView,SLOT(setHl(int))); | 248 | connect(viewDecFontSizes,SIGNAL(activated()), currentView,SLOT(slotDecFontSizes())); |
226 | connect(utilSettings,SIGNAL(activated()), currentView,SLOT(configDialog())); | 249 | connect(hlmenu,SIGNAL(activated(int)), currentView,SLOT(setHl(int))); |
250 | connect(utilSettings,SIGNAL(activated()), currentView,SLOT(configDialog())); | ||
227 | 251 | ||
228 | } | 252 | } |
229 | 253 | ||
230 | void TinyKate::slotNew( ) | 254 | void TinyKate::slotNew( ) |
231 | { | 255 | { |
232 | KateDocument *kd= new KateDocument(false, false, this,0,this); | 256 | KateDocument *kd= new KateDocument(false, false, this,0,this); |
233 | KTextEditor::View *kv; | 257 | KTextEditor::View *kv; |
234 | tabwidget->addTab(kv=kd->createView(tabwidget,"BLAH"), | 258 | tabwidget->addTab(kv=kd->createView(tabwidget,"BLAH"), |
235 | "tinykate/tinykate", | 259 | "tinykate/tinykate", |
236 | tr("Unnamed %1").arg(nextUnnamed++)); | 260 | tr("Unnamed %1").arg(nextUnnamed++)); |
237 | viewCount++; | 261 | viewCount++; |
238 | } | 262 | } |
239 | 263 | ||
240 | void TinyKate::slotClose( ) | 264 | void TinyKate::slotClose( ) |
241 | { | 265 | { |
242 | if (currentView==0) return; | 266 | if (currentView==0) return; |
243 | KTextEditor::View *dv=currentView; | 267 | KTextEditor::View *dv=currentView; |
244 | currentView=0; | 268 | currentView=0; |
245 | tabwidget->removePage(dv); | 269 | tabwidget->removePage(dv); |
246 | delete dv->document(); | 270 | delete dv->document(); |
247 | viewCount--; | 271 | viewCount--; |
248 | if ((!viewCount) && (!shutDown)) slotNew(); | 272 | if ((!viewCount) && (!shutDown)) slotNew(); |
249 | } | 273 | } |
250 | 274 | ||
251 | void TinyKate::slotSave() { | 275 | void TinyKate::slotSave() |
252 | // feel free to make this how you want | 276 | { |
253 | if (currentView==0) return; | 277 | // feel free to make this how you want |
254 | 278 | if (currentView==0) return; | |
255 | // KateView *kv = (KateView*) currentView; | 279 | |
256 | KateDocument *kd = (KateDocument*) currentView->document(); | 280 | // KateView *kv = (KateView*) currentView; |
257 | // odebug << "saving file "+kd->docName() << oendl; | 281 | KateDocument *kd = (KateDocument*) currentView->document(); |
258 | if( kd->docName().isEmpty()) | 282 | // odebug << "saving file "+kd->docName() << oendl; |
259 | slotSaveAs(); | 283 | if( kd->docName().isEmpty()) |
260 | else | 284 | slotSaveAs(); |
261 | kd->saveFile(); | 285 | else |
262 | // kv->save(); | 286 | kd->saveFile(); |
263 | // kd->saveFile(); | 287 | // kv->save(); |
288 | // kd->saveFile(); | ||
264 | } | 289 | } |
265 | 290 | ||
266 | void TinyKate::slotSaveAs() { | 291 | void TinyKate::slotSaveAs() |
267 | if (currentView==0) return; | 292 | { |
268 | KateDocument *kd = (KateDocument*) currentView->document(); | 293 | if (currentView==0) return; |
269 | 294 | KateDocument *kd = (KateDocument*) currentView->document(); | |
270 | QString filename= OFileDialog::getSaveFileName(OFileSelector::EXTENDED_ALL, | 295 | |
271 | QString::null); | 296 | QString filename= OFileDialog::getSaveFileName(OFileSelector::EXTENDED_ALL, |
272 | if (!filename.isEmpty()) { | 297 | QString::null); |
273 | odebug << "saving file "+filename << oendl; | 298 | if (!filename.isEmpty()) |
274 | QFileInfo fi(filename); | 299 | { |
275 | QString filenamed = fi.fileName(); | 300 | odebug << "saving file "+filename << oendl; |
276 | kd->setDocFile( filename); | 301 | QFileInfo fi(filename); |
277 | kd->setDocName( filenamed); | 302 | QString filenamed = fi.fileName(); |
278 | kd->saveFile(); | 303 | kd->setDocFile( filename); |
279 | // KTextEditor::View *dv = currentView; | 304 | kd->setDocName( filenamed); |
280 | // tabwidget->changeTab( dv, filenamed); | 305 | kd->saveFile(); |
281 | // need to change tab label here | 306 | // KTextEditor::View *dv = currentView; |
282 | } | 307 | // tabwidget->changeTab( dv, filenamed); |
308 | // need to change tab label here | ||
309 | } | ||
283 | 310 | ||
284 | } | 311 | } |
diff --git a/noncore/apps/tinykate/mainwindow/tinykate.h b/noncore/apps/tinykate/mainwindow/tinykate.h index f435c03..f630f62 100644 --- a/noncore/apps/tinykate/mainwindow/tinykate.h +++ b/noncore/apps/tinykate/mainwindow/tinykate.h | |||
@@ -24,26 +24,26 @@ | |||
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 | static QString appName() { return QString::fromLatin1( "kate" ); }; | 36 | static QString appName() { return QString::fromLatin1( "kate" ); }; |
37 | 37 | ||
38 | 38 | ||
39 | public slots: | 39 | public slots: |
40 | void slotNew(); | 40 | void slotNew(); |
41 | void setDocument(const QString& fileref); | 41 | void setDocument(const QString& fileref); |
42 | 42 | ||
43 | protected slots: | 43 | protected slots: |
44 | void slotOpen(); | 44 | void slotOpen(); |
45 | void slotClose(); | 45 | void slotClose(); |
46 | void slotCurrentChanged(QWidget *); | 46 | void slotCurrentChanged(QWidget *); |
47 | void slotSave(); | 47 | void slotSave(); |
48 | void slotSaveAs(); | 48 | void slotSaveAs(); |
49 | protected: | 49 | protected: |