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

List:       kde-commits
Subject:    KDE_3_1_BRANCH: kdeutils/kedit
From:       Laurent Montel <montel () kde ! org>
Date:       2003-07-25 14:48:01
[Download RAW message or body]

CVS commit by mlaurent: 

Backport undo/redo when we insert file


  M +9 -3      kedit.cpp   1.165.2.7
  M +2 -2      kedit.h   1.62.2.1


--- kdeutils/kedit/kedit.cpp  #1.165.2.6:1.165.2.7
@@ -532,5 +532,5 @@ void TopLevel::file_insert()
     QString tmpfile;
     KIO::NetAccess::download( url, tmpfile );
-    int result = openFile( tmpfile, OPEN_INSERT, url.fileEncoding() );
+    int result = openFile( tmpfile, OPEN_INSERT, url.fileEncoding(), true );
     KIO::NetAccess::removeTempFile( tmpfile );
 
@@ -1111,5 +1111,5 @@ int TopLevel::saveURL( const KURL& _url 
 }
 
-int TopLevel::openFile( const QString& _filename, int _mode, const QString &encoding \
) +int TopLevel::openFile( const QString& _filename, int _mode, const QString \
&encoding,  bool _undoAction )  {
   QFileInfo info(_filename);
@@ -1149,6 +1149,12 @@ int TopLevel::openFile( const QString& _
      eframe->clear();
   }
+  if ( ! _undoAction )
+      eframe->setUndoRedoEnabled(false);
+
   eframe->insertText( &stream );
   eframe->setModified(false);
+  if ( ! _undoAction )
+      eframe->setUndoRedoEnabled(true);
+
   return KEDIT_OK;
 

--- kdeutils/kedit/kedit.h  #1.62:1.62.2.1
@@ -77,5 +77,5 @@ public:
      * @return KEDIT_OK on success
      */
-    int openFile( const QString& _filename, int _mode, const QString &encoding);
+    int openFile( const QString& _filename, int _mode, const QString &encoding,  \
bool _undoAction = false );  
     /**


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

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