author | llornkcor <llornkcor> | 2004-12-28 06:35:27 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2004-12-28 06:35:27 (UTC) |
commit | 97a3d431ba9e33a3e256955755b23a55a9a9ea05 (patch) (side-by-side diff) | |
tree | 05ba989cc0127f5b1c57e125cb847de1513ad566 | |
parent | 02395040e422485ceb2fa435a3fb30879d5f3df2 (diff) | |
download | opie-97a3d431ba9e33a3e256955755b23a55a9a9ea05.zip opie-97a3d431ba9e33a3e256955755b23a55a9a9ea05.tar.gz opie-97a3d431ba9e33a3e256955755b23a55a9a9ea05.tar.bz2 |
patch fixing #1500 - wrong disconnect, from Seneca
-rw-r--r-- | noncore/apps/tinykate/mainwindow/tinykate.cpp | 10 |
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 @@ -101,211 +101,211 @@ TinyKate::TinyKate( QWidget *parent, const char *name, WFlags f) : editPaste->setIconSet( Resource::loadPixmap( "paste" ) ); // Action for finding / replacing text editFindReplace = new QToolButton( 0 ); editFindReplace->setAutoRaise( true ); editFindReplace->setIconSet( Resource::loadPixmap("find") ); // Action for undo editUndo = new QToolButton( 0 ); editUndo->setAutoRaise( true ); editUndo->setIconSet( Resource::loadPixmap( "undo" ) ); // Action for redo editRedo = new QToolButton( 0 ); editRedo->setAutoRaise( true ); editRedo->setIconSet( Resource::loadPixmap( "redo" ) ); //VIEW ACITONS popup = new QPopupMenu( this ); viewIncFontSizes = new QAction( tr( "Font +" ), QString::null, 0, this, 0 ); viewIncFontSizes->addTo( popup ); viewDecFontSizes = new QAction( tr( "Font -" ), QString::null, 0, this, 0 ); viewDecFontSizes->addTo( popup ); mb->insertItem(tr("View"),popup); popup = new QPopupMenu( this ); mb->insertItem(tr("Utils"),popup); mb->insertItem( editCut ); mb->insertItem( editCopy ); mb->insertItem( editPaste ); mb->insertItem( editFindReplace ); mb->insertItem( editUndo ); mb->insertItem( editRedo ); //Highlight management hlmenu=new QPopupMenu(this); HlManager *hlm=HlManager::self(); for (int i=0;i<hlm->highlights();i++) { hlmenu->insertItem(hlm->hlName(i),i); } popup->insertItem(tr("Highlighting"),hlmenu); utilSettings = new QAction( tr( "Settings" ), QString::null, 0, this, 0 ); utilSettings->addTo( popup); if( qApp->argc() > 1) open(qApp->argv()[1]); else slotNew(); } TinyKate::~TinyKate( ) { owarn << "TinyKate destructor\n" << oendl; shutDown=true; while (currentView!=0) { slotClose(); } if( KGlobal::config() != 0 ) { owarn << "deleting KateConfig object..\n" << oendl; delete KGlobal::config(); } } void TinyKate::slotOpen( ) { QString filename = OFileDialog::getOpenFileName( OFileSelector::EXTENDED_ALL, QString::null); if (!filename.isEmpty()) { open(filename); } } void TinyKate::open(const QString & filename) { KateDocument *kd= new KateDocument(false, false, this,0,this); KTextEditor::View *kv; QString realFileName; //check if filename is a .desktop file if ( filename.find( ".desktop", 0, true ) ) { switch ( QMessageBox::warning( this, tr( "TinyKATE" ), tr("TinyKATE has detected<BR>you selected a <B>.desktop</B> file.<BR>Open <B>.desktop</B> file or <B>linked</B> file?" ), tr(".desktop File"), tr("Linked Document"), 0, 1, 1 ) ) { case 0: //desktop realFileName = filename; break; case 1: //linked DocLnk docLnk( filename ); realFileName = docLnk.file(); break; }; } QFileInfo fileInfo( realFileName ); QString filenamed = fileInfo.fileName(); tabwidget->addTab(kv=kd->createView(tabwidget,"bLAH"),"tinykate/tinykate", filenamed ); odebug << realFileName << oendl; kd->setDocName( filenamed); kd->open( realFileName ); viewCount++; } void TinyKate::setDocument(const QString& fileref) { open( fileref ); } void TinyKate::slotCurrentChanged( QWidget * view) { if (currentView) { - disconnect(editCopy,SIGNAL(activated()),currentView,SLOT(copy())); - disconnect(editCut,SIGNAL(activated()),currentView,SLOT(cut())); - disconnect(editPaste,SIGNAL(activated()),currentView,SLOT(paste())); - disconnect(editUndo,SIGNAL(activated()),currentView,SLOT(undo())); - disconnect(editRedo,SIGNAL(activated()),currentView,SLOT(redo())); + disconnect(editCopy,SIGNAL(clicked()),currentView,SLOT(copy())); + disconnect(editCut,SIGNAL(clicked()),currentView,SLOT(cut())); + disconnect(editPaste,SIGNAL(clicked()),currentView,SLOT(paste())); + disconnect(editUndo,SIGNAL(clicked()),currentView,SLOT(undo())); + disconnect(editRedo,SIGNAL(clicked()),currentView,SLOT(redo())); disconnect(viewIncFontSizes,SIGNAL(activated()), currentView,SLOT(slotIncFontSizes())); disconnect(viewDecFontSizes,SIGNAL(activated()), currentView,SLOT(slotDecFontSizes())); disconnect(hlmenu,SIGNAL(activated(int)), currentView,SLOT(setHl(int))); disconnect(utilSettings,SIGNAL(activated()), currentView,SLOT(configDialog())); } currentView=(KTextEditor::View*)view; connect(editCopy,SIGNAL(clicked()),currentView,SLOT(copy())); connect(editCut,SIGNAL(clicked()),currentView,SLOT(cut())); connect(editPaste,SIGNAL(clicked()),currentView,SLOT(paste())); connect(editUndo,SIGNAL(clicked()),currentView,SLOT(undo())); connect(editRedo,SIGNAL(clicked()),currentView,SLOT(redo())); connect(viewIncFontSizes,SIGNAL(activated()), currentView,SLOT(slotIncFontSizes())); connect(viewDecFontSizes,SIGNAL(activated()), currentView,SLOT(slotDecFontSizes())); connect(hlmenu,SIGNAL(activated(int)), currentView,SLOT(setHl(int))); connect(utilSettings,SIGNAL(activated()), currentView,SLOT(configDialog())); } void TinyKate::slotNew( ) { KateDocument *kd= new KateDocument(false, false, this,0,this); KTextEditor::View *kv; tabwidget->addTab(kv=kd->createView(tabwidget,"BLAH"), "tinykate/tinykate", tr("Unnamed %1").arg(nextUnnamed++)); viewCount++; } void TinyKate::slotClose( ) { if (currentView==0) return; KTextEditor::View *dv=currentView; currentView=0; tabwidget->removePage(dv); delete dv->document(); viewCount--; if ((!viewCount) && (!shutDown)) slotNew(); } void TinyKate::slotSave() { // feel free to make this how you want if (currentView==0) return; // KateView *kv = (KateView*) currentView; KateDocument *kd = (KateDocument*) currentView->document(); // odebug << "saving file "+kd->docName() << oendl; if( kd->docName().isEmpty()) slotSaveAs(); else kd->saveFile(); // kv->save(); // kd->saveFile(); } void TinyKate::slotSaveAs() { if (currentView==0) return; KateDocument *kd = (KateDocument*) currentView->document(); QString filename= OFileDialog::getSaveFileName(OFileSelector::EXTENDED_ALL, QString::null); if (!filename.isEmpty()) { odebug << "saving file "+filename << oendl; QFileInfo fi(filename); QString filenamed = fi.fileName(); kd->setDocFile( filename); kd->setDocName( filenamed); kd->saveFile(); // KTextEditor::View *dv = currentView; // tabwidget->changeTab( dv, filenamed); // need to change tab label here } } |