From kde-commits Sat Jul 19 21:06:57 2003 From: Harald Fernengel Date: Sat, 19 Jul 2003 21:06:57 +0000 To: kde-commits Subject: kdevelop/parts/qeditor X-MARC-Message: https://marc.info/?l=kde-commits&m=105864889327334 CVS commit by harald: added Reload action M +16 -10 qeditor_part.cpp 1.52 M +4 -1 qeditor_part.h 1.27 M +2 -1 qeditor_part.rc 1.16 M +4 -1 qeditor_view.cpp 1.43 --- kdevelop/parts/qeditor/qeditor_part.cpp #1.51:1.52 @@ -159,13 +159,13 @@ void QEditorPart::setModified(bool modif // get a handle on our Save action and make sure it is valid KAction *save = m_currentView->actionCollection()->action(KStdAction::stdName(KStdAction::Save)); - if (!save) - return; - + if (save) // if so, we either enable or disable it based on the current // state - if (modified) - save->setEnabled(true); - else - save->setEnabled(false); + save->setEnabled(modified); + + // same for the reload action + KAction *reload = m_currentView->actionCollection()->action(i18n("Reloa&d")); + if ( reload ) + reload->setEnabled(modified); emit newStatus(); @@ -227,4 +227,10 @@ bool QEditorPart::saveFile() return true; +} + +void QEditorPart::fileReload() +{ + if (openURL(url())) + setModified( false ); } --- kdevelop/parts/qeditor/qeditor_part.h #1.26:1.27 @@ -375,4 +375,7 @@ protected: virtual bool saveFile(); +public slots: + void fileReload(); + protected slots: void fileOpen(); --- kdevelop/parts/qeditor/qeditor_part.rc #1.15:1.16 @@ -1,4 +1,4 @@ - + @@ -6,4 +6,5 @@ + --- kdevelop/parts/qeditor/qeditor_view.cpp #1.42:1.43 @@ -667,4 +667,7 @@ void QEditorView::setupActions() KStdAction::save( doc(), SLOT(save()), actionCollection() ); + new KAction( i18n("Reloa&d"), "reload", Key_F5, + doc(), SLOT(fileReload()), actionCollection(), "file_reload" ); + KStdAction::undo( doc(), SLOT(undo()), actionCollection() ); KStdAction::redo( doc(), SLOT(redo()), actionCollection() );