summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/tinykate/mainwindow/tinykate.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/noncore/apps/tinykate/mainwindow/tinykate.cpp b/noncore/apps/tinykate/mainwindow/tinykate.cpp
index 30c07fc..8d19c71 100644
--- a/noncore/apps/tinykate/mainwindow/tinykate.cpp
+++ b/noncore/apps/tinykate/mainwindow/tinykate.cpp
@@ -165,133 +165,133 @@ TinyKate::~TinyKate( )
165 { 165 {
166 slotClose(); 166 slotClose();
167 } 167 }
168 168
169 if( KGlobal::config() != 0 ) 169 if( KGlobal::config() != 0 )
170 { 170 {
171 owarn << "deleting KateConfig object..\n" << oendl; 171 owarn << "deleting KateConfig object..\n" << oendl;
172 delete KGlobal::config(); 172 delete KGlobal::config();
173 } 173 }
174} 174}
175 175
176void TinyKate::slotOpen( ) 176void TinyKate::slotOpen( )
177{ 177{
178 QString filename = OFileDialog::getOpenFileName( OFileSelector::EXTENDED_ALL, 178 QString filename = OFileDialog::getOpenFileName( OFileSelector::EXTENDED_ALL,
179 QString::null); 179 QString::null);
180 if (!filename.isEmpty()) 180 if (!filename.isEmpty())
181 { 181 {
182 open(filename); 182 open(filename);
183 } 183 }
184} 184}
185 185
186void TinyKate::open(const QString & filename) 186void TinyKate::open(const QString & filename)
187{ 187{
188 KateDocument *kd= new KateDocument(false, false, this,0,this); 188 KateDocument *kd= new KateDocument(false, false, this,0,this);
189 KTextEditor::View *kv; 189 KTextEditor::View *kv;
190 QString realFileName; 190 QString realFileName;
191 //check if filename is a .desktop file 191 //check if filename is a .desktop file
192 if ( filename.find( ".desktop", 0, true ) ) 192 if ( filename.find( ".desktop", 0, true ) )
193 { 193 {
194 switch ( QMessageBox::warning( this, tr( "TinyKATE" ), 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?" ), 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"), 196 tr(".desktop File"),
197 tr("Linked Document"), 0, 1, 1 ) ) 197 tr("Linked Document"), 0, 1, 1 ) )
198 { 198 {
199 case 0: //desktop 199 case 0: //desktop
200 realFileName = filename; 200 realFileName = filename;
201 break; 201 break;
202 case 1: //linked 202 case 1: //linked
203 DocLnk docLnk( filename ); 203 DocLnk docLnk( filename );
204 realFileName = docLnk.file(); 204 realFileName = docLnk.file();
205 break; 205 break;
206 }; 206 };
207 } 207 }
208 208
209 QFileInfo fileInfo( realFileName ); 209 QFileInfo fileInfo( realFileName );
210 QString filenamed = fileInfo.fileName(); 210 QString filenamed = fileInfo.fileName();
211 tabwidget->addTab(kv=kd->createView(tabwidget,"bLAH"),"tinykate/tinykate", filenamed ); 211 tabwidget->addTab(kv=kd->createView(tabwidget,"bLAH"),"tinykate/tinykate", filenamed );
212 odebug << realFileName << oendl; 212 odebug << realFileName << oendl;
213 213
214 kd->setDocName( filenamed); 214 kd->setDocName( filenamed);
215 kd->open( realFileName ); 215 kd->open( realFileName );
216 viewCount++; 216 viewCount++;
217} 217}
218 218
219void TinyKate::setDocument(const QString& fileref) 219void TinyKate::setDocument(const QString& fileref)
220{ 220{
221 open( fileref ); 221 open( fileref );
222} 222}
223 223
224void TinyKate::slotCurrentChanged( QWidget * view) 224void TinyKate::slotCurrentChanged( QWidget * view)
225{ 225{
226 if (currentView) 226 if (currentView)
227 { 227 {
228 228
229 disconnect(editCopy,SIGNAL(activated()),currentView,SLOT(copy())); 229 disconnect(editCopy,SIGNAL(clicked()),currentView,SLOT(copy()));
230 disconnect(editCut,SIGNAL(activated()),currentView,SLOT(cut())); 230 disconnect(editCut,SIGNAL(clicked()),currentView,SLOT(cut()));
231 disconnect(editPaste,SIGNAL(activated()),currentView,SLOT(paste())); 231 disconnect(editPaste,SIGNAL(clicked()),currentView,SLOT(paste()));
232 disconnect(editUndo,SIGNAL(activated()),currentView,SLOT(undo())); 232 disconnect(editUndo,SIGNAL(clicked()),currentView,SLOT(undo()));
233 disconnect(editRedo,SIGNAL(activated()),currentView,SLOT(redo())); 233 disconnect(editRedo,SIGNAL(clicked()),currentView,SLOT(redo()));
234 disconnect(viewIncFontSizes,SIGNAL(activated()), currentView,SLOT(slotIncFontSizes())); 234 disconnect(viewIncFontSizes,SIGNAL(activated()), currentView,SLOT(slotIncFontSizes()));
235 disconnect(viewDecFontSizes,SIGNAL(activated()), currentView,SLOT(slotDecFontSizes())); 235 disconnect(viewDecFontSizes,SIGNAL(activated()), currentView,SLOT(slotDecFontSizes()));
236 disconnect(hlmenu,SIGNAL(activated(int)), currentView,SLOT(setHl(int))); 236 disconnect(hlmenu,SIGNAL(activated(int)), currentView,SLOT(setHl(int)));
237 disconnect(utilSettings,SIGNAL(activated()), currentView,SLOT(configDialog())); 237 disconnect(utilSettings,SIGNAL(activated()), currentView,SLOT(configDialog()));
238 } 238 }
239 239
240 currentView=(KTextEditor::View*)view; 240 currentView=(KTextEditor::View*)view;
241 241
242 connect(editCopy,SIGNAL(clicked()),currentView,SLOT(copy())); 242 connect(editCopy,SIGNAL(clicked()),currentView,SLOT(copy()));
243 connect(editCut,SIGNAL(clicked()),currentView,SLOT(cut())); 243 connect(editCut,SIGNAL(clicked()),currentView,SLOT(cut()));
244 connect(editPaste,SIGNAL(clicked()),currentView,SLOT(paste())); 244 connect(editPaste,SIGNAL(clicked()),currentView,SLOT(paste()));
245 connect(editUndo,SIGNAL(clicked()),currentView,SLOT(undo())); 245 connect(editUndo,SIGNAL(clicked()),currentView,SLOT(undo()));
246 connect(editRedo,SIGNAL(clicked()),currentView,SLOT(redo())); 246 connect(editRedo,SIGNAL(clicked()),currentView,SLOT(redo()));
247 connect(viewIncFontSizes,SIGNAL(activated()), currentView,SLOT(slotIncFontSizes())); 247 connect(viewIncFontSizes,SIGNAL(activated()), currentView,SLOT(slotIncFontSizes()));
248 connect(viewDecFontSizes,SIGNAL(activated()), currentView,SLOT(slotDecFontSizes())); 248 connect(viewDecFontSizes,SIGNAL(activated()), currentView,SLOT(slotDecFontSizes()));
249 connect(hlmenu,SIGNAL(activated(int)), currentView,SLOT(setHl(int))); 249 connect(hlmenu,SIGNAL(activated(int)), currentView,SLOT(setHl(int)));
250 connect(utilSettings,SIGNAL(activated()), currentView,SLOT(configDialog())); 250 connect(utilSettings,SIGNAL(activated()), currentView,SLOT(configDialog()));
251 251
252} 252}
253 253
254void TinyKate::slotNew( ) 254void TinyKate::slotNew( )
255{ 255{
256 KateDocument *kd= new KateDocument(false, false, this,0,this); 256 KateDocument *kd= new KateDocument(false, false, this,0,this);
257 KTextEditor::View *kv; 257 KTextEditor::View *kv;
258 tabwidget->addTab(kv=kd->createView(tabwidget,"BLAH"), 258 tabwidget->addTab(kv=kd->createView(tabwidget,"BLAH"),
259 "tinykate/tinykate", 259 "tinykate/tinykate",
260 tr("Unnamed %1").arg(nextUnnamed++)); 260 tr("Unnamed %1").arg(nextUnnamed++));
261 viewCount++; 261 viewCount++;
262} 262}
263 263
264void TinyKate::slotClose( ) 264void TinyKate::slotClose( )
265{ 265{
266 if (currentView==0) return; 266 if (currentView==0) return;
267 KTextEditor::View *dv=currentView; 267 KTextEditor::View *dv=currentView;
268 currentView=0; 268 currentView=0;
269 tabwidget->removePage(dv); 269 tabwidget->removePage(dv);
270 delete dv->document(); 270 delete dv->document();
271 viewCount--; 271 viewCount--;
272 if ((!viewCount) && (!shutDown)) slotNew(); 272 if ((!viewCount) && (!shutDown)) slotNew();
273} 273}
274 274
275void TinyKate::slotSave() 275void TinyKate::slotSave()
276{ 276{
277 // feel free to make this how you want 277 // feel free to make this how you want
278 if (currentView==0) return; 278 if (currentView==0) return;
279 279
280 // KateView *kv = (KateView*) currentView; 280 // KateView *kv = (KateView*) currentView;
281 KateDocument *kd = (KateDocument*) currentView->document(); 281 KateDocument *kd = (KateDocument*) currentView->document();
282 // odebug << "saving file "+kd->docName() << oendl; 282 // odebug << "saving file "+kd->docName() << oendl;
283 if( kd->docName().isEmpty()) 283 if( kd->docName().isEmpty())
284 slotSaveAs(); 284 slotSaveAs();
285 else 285 else
286 kd->saveFile(); 286 kd->saveFile();
287 // kv->save(); 287 // kv->save();
288 // kd->saveFile(); 288 // kd->saveFile();
289} 289}
290 290
291void TinyKate::slotSaveAs() 291void TinyKate::slotSaveAs()
292{ 292{
293 if (currentView==0) return; 293 if (currentView==0) return;
294 KateDocument *kd = (KateDocument*) currentView->document(); 294 KateDocument *kd = (KateDocument*) currentView->document();
295 295
296 QString filename= OFileDialog::getSaveFileName(OFileSelector::EXTENDED_ALL, 296 QString filename= OFileDialog::getSaveFileName(OFileSelector::EXTENDED_ALL,
297 QString::null); 297 QString::null);