summaryrefslogtreecommitdiff
path: root/noncore/apps/tinykate
Unidiff
Diffstat (limited to 'noncore/apps/tinykate') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/tinykate/mainwindow/tinykate.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/noncore/apps/tinykate/mainwindow/tinykate.cpp b/noncore/apps/tinykate/mainwindow/tinykate.cpp
index bbb0be7e..e808a2e 100644
--- a/noncore/apps/tinykate/mainwindow/tinykate.cpp
+++ b/noncore/apps/tinykate/mainwindow/tinykate.cpp
@@ -158,111 +158,112 @@ TinyKate::TinyKate( QWidget *parent, const char *name, WFlags f) :
158 hlmenu->insertItem(hlm->hlName(i),i); 158 hlmenu->insertItem(hlm->hlName(i),i);
159 } 159 }
160 popup->insertItem(tr("Highlighting"),hlmenu); 160 popup->insertItem(tr("Highlighting"),hlmenu);
161 161
162 162
163 utilSettings = new QAction( tr( "Settings" ), 163 utilSettings = new QAction( tr( "Settings" ),
164 Opie::Core::OResource::loadPixmap( "SettingsIcon", Opie::Core::OResource::SmallIcon ), 164 Opie::Core::OResource::loadPixmap( "SettingsIcon", Opie::Core::OResource::SmallIcon ),
165 QString::null, 0, this, 0 ); 165 QString::null, 0, this, 0 );
166 utilSettings->addTo( popup); 166 utilSettings->addTo( popup);
167 167
168 if( qApp->argc() > 1) open(qApp->argv()[1]); 168 if( qApp->argc() > 1) open(qApp->argv()[1]);
169 else slotNew(); 169 else slotNew();
170 170
171} 171}
172 172
173TinyKate::~TinyKate( ) 173TinyKate::~TinyKate( )
174{ 174{
175 owarn << "TinyKate destructor\n" << oendl; 175 owarn << "TinyKate destructor\n" << oendl;
176 176
177 shutDown=true; 177 shutDown=true;
178 while (currentView!=0) 178 while (currentView!=0)
179 { 179 {
180 slotClose(); 180 slotClose();
181 } 181 }
182 182
183 if( KGlobal::config() != 0 ) 183 if( KGlobal::config() != 0 )
184 { 184 {
185 owarn << "deleting KateConfig object..\n" << oendl; 185 owarn << "deleting KateConfig object..\n" << oendl;
186 delete KGlobal::config(); 186 delete KGlobal::config();
187 } 187 }
188} 188}
189 189
190void TinyKate::slotOpen( ) 190void TinyKate::slotOpen( )
191{ 191{
192 QString filename = OFileDialog::getOpenFileName( OFileSelector::EXTENDED_ALL, 192 QString filename = OFileDialog::getOpenFileName( OFileSelector::EXTENDED_ALL,
193 QString::null); 193 QString::null);
194 if (!filename.isEmpty()) 194 if (!filename.isEmpty())
195 { 195 {
196 open(filename); 196 open(filename);
197 } 197 }
198} 198}
199 199
200void TinyKate::open(const QString & filename) 200void TinyKate::open(const QString & filename)
201{ 201{
202 KateDocument *kd= new KateDocument(false, false, this,0,this); 202 KateDocument *kd= new KateDocument(false, false, this,0,this);
203 KTextEditor::View *kv; 203 KTextEditor::View *kv;
204 QString realFileName; 204 QString realFileName;
205 //check if filename is a .desktop file 205 //check if filename is a .desktop file
206 if ( filename.find( ".desktop", 0, true ) ) 206 if ( filename.find( ".desktop", 0, true ) != -1 ) {
207 {
208 switch ( QMessageBox::warning( this, tr( "TinyKATE" ), 207 switch ( QMessageBox::warning( this, tr( "TinyKATE" ),
209 tr("TinyKATE has detected<BR>you selected a <B>.desktop</B> file.<BR>Open <B>.desktop</B> file or <B>linked</B> file?" ), 208 tr("TinyKATE has detected<BR>you selected a <B>.desktop</B> file.<BR>Open <B>.desktop</B> file or <B>linked</B> file?" ),
210 tr(".desktop File"), 209 tr(".desktop File"),
211 tr("Linked Document"), 0, 1, 1 ) ) 210 tr("Linked Document"), 0, 1, 1 ) )
212 { 211 {
213 case 0: //desktop 212 case 0: //desktop
214 realFileName = filename; 213 realFileName = filename;
215 break; 214 break;
216 case 1: //linked 215 case 1: //linked
217 DocLnk docLnk( filename ); 216 DocLnk docLnk( filename );
218 realFileName = docLnk.file(); 217 realFileName = docLnk.file();
219 break; 218 break;
220 }; 219 };
220 } else {
221 realFileName = filename;
221 } 222 }
222 223
223 QFileInfo fileInfo( realFileName ); 224 QFileInfo fileInfo( realFileName );
224 QString filenamed = fileInfo.fileName(); 225 QString filenamed = fileInfo.fileName();
225 tabwidget->addTab(kv=kd->createView(tabwidget,"bLAH"),"tinykate/tinykate", filenamed ); 226 tabwidget->addTab(kv=kd->createView(tabwidget,"bLAH"),"tinykate/tinykate", filenamed );
226 odebug << realFileName << oendl; 227 odebug << realFileName << oendl;
227 228
228 kd->setDocName( filenamed); 229 kd->setDocName( filenamed);
229 kd->open( realFileName ); 230 kd->open( realFileName );
230 viewCount++; 231 viewCount++;
231} 232}
232 233
233void TinyKate::setDocument(const QString& fileref) 234void TinyKate::setDocument(const QString& fileref)
234{ 235{
235 open( fileref ); 236 open( fileref );
236} 237}
237 238
238void TinyKate::slotCurrentChanged( QWidget * view) 239void TinyKate::slotCurrentChanged( QWidget * view)
239{ 240{
240 if (currentView) 241 if (currentView)
241 { 242 {
242 243
243 disconnect(editCopy,SIGNAL(clicked()),currentView,SLOT(copy())); 244 disconnect(editCopy,SIGNAL(clicked()),currentView,SLOT(copy()));
244 disconnect(editCut,SIGNAL(clicked()),currentView,SLOT(cut())); 245 disconnect(editCut,SIGNAL(clicked()),currentView,SLOT(cut()));
245 disconnect(editPaste,SIGNAL(clicked()),currentView,SLOT(paste())); 246 disconnect(editPaste,SIGNAL(clicked()),currentView,SLOT(paste()));
246 disconnect(editUndo,SIGNAL(clicked()),currentView,SLOT(undo())); 247 disconnect(editUndo,SIGNAL(clicked()),currentView,SLOT(undo()));
247 disconnect(editRedo,SIGNAL(clicked()),currentView,SLOT(redo())); 248 disconnect(editRedo,SIGNAL(clicked()),currentView,SLOT(redo()));
248 disconnect(viewIncFontSizes,SIGNAL(activated()), currentView,SLOT(slotIncFontSizes())); 249 disconnect(viewIncFontSizes,SIGNAL(activated()), currentView,SLOT(slotIncFontSizes()));
249 disconnect(viewDecFontSizes,SIGNAL(activated()), currentView,SLOT(slotDecFontSizes())); 250 disconnect(viewDecFontSizes,SIGNAL(activated()), currentView,SLOT(slotDecFontSizes()));
250 disconnect(hlmenu,SIGNAL(activated(int)), currentView,SLOT(setHl(int))); 251 disconnect(hlmenu,SIGNAL(activated(int)), currentView,SLOT(setHl(int)));
251 disconnect(utilSettings,SIGNAL(activated()), currentView,SLOT(configDialog())); 252 disconnect(utilSettings,SIGNAL(activated()), currentView,SLOT(configDialog()));
252 } 253 }
253 254
254 currentView=(KTextEditor::View*)view; 255 currentView=(KTextEditor::View*)view;
255 256
256 connect(editCopy,SIGNAL(clicked()),currentView,SLOT(copy())); 257 connect(editCopy,SIGNAL(clicked()),currentView,SLOT(copy()));
257 connect(editCut,SIGNAL(clicked()),currentView,SLOT(cut())); 258 connect(editCut,SIGNAL(clicked()),currentView,SLOT(cut()));
258 connect(editPaste,SIGNAL(clicked()),currentView,SLOT(paste())); 259 connect(editPaste,SIGNAL(clicked()),currentView,SLOT(paste()));
259 connect(editUndo,SIGNAL(clicked()),currentView,SLOT(undo())); 260 connect(editUndo,SIGNAL(clicked()),currentView,SLOT(undo()));
260 connect(editRedo,SIGNAL(clicked()),currentView,SLOT(redo())); 261 connect(editRedo,SIGNAL(clicked()),currentView,SLOT(redo()));
261 connect(viewIncFontSizes,SIGNAL(activated()), currentView,SLOT(slotIncFontSizes())); 262 connect(viewIncFontSizes,SIGNAL(activated()), currentView,SLOT(slotIncFontSizes()));
262 connect(viewDecFontSizes,SIGNAL(activated()), currentView,SLOT(slotDecFontSizes())); 263 connect(viewDecFontSizes,SIGNAL(activated()), currentView,SLOT(slotDecFontSizes()));
263 connect(hlmenu,SIGNAL(activated(int)), currentView,SLOT(setHl(int))); 264 connect(hlmenu,SIGNAL(activated(int)), currentView,SLOT(setHl(int)));
264 connect(utilSettings,SIGNAL(activated()), currentView,SLOT(configDialog())); 265 connect(utilSettings,SIGNAL(activated()), currentView,SLOT(configDialog()));
265 266
266} 267}
267 268
268void TinyKate::slotNew( ) 269void TinyKate::slotNew( )