[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdevelop/parts/qeditor
From:       Harald Fernengel <harry () kdevelop ! org>
Date:       2003-07-19 21:06:57
[Download RAW message or body]

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 @@
 <!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
-<kpartgui name="qeditor_part" version="10">
+<kpartgui name="qeditor_part" version="11">
 <MenuBar noMerge="1">
 
@@ -6,4 +6,5 @@
     <Action name="file_save" group="save_merge" />
     <Action name="file_save_as" group="save_merge" />
+    <Action name="file_reload" />
   </Menu>
 

--- 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() );


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic