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

List:       kde-commits
Subject:    KDE/kdebase/libkonq
From:       David Faure <faure () kde ! org>
Date:       2007-01-25 20:36:51
Message-ID: 1169757411.479952.15994.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 627156 by dfaure:

Expose default implementation of UiInterface


 M  +28 -28    konq_undo.cc  
 M  +6 -2      konq_undo.h  
 M  +1 -1      tests/konqundomanagertest.cpp  


--- trunk/KDE/kdebase/libkonq/konq_undo.cc #627155:627156
@@ -153,38 +153,11 @@
 KonqUndoManager *KonqUndoManager::s_self = 0;
 static unsigned long s_undoManagerRefCnt = 0;
 
-class KonqUndoUiInterface : public KonqUndoManager::UiInterface
-{
-public:
-    KonqUndoUiInterface() {} // TODO pass and store QWidget*
-
-    virtual void jobError( KIO::Job* job ) {
-        job->ui()->showErrorMessage();
-    }
-
-    virtual bool copiedFileWasModified( const KUrl& src, const KUrl& dest, time_t \
                srcTime, time_t destTime ) {
-        Q_UNUSED( srcTime ); // not sure it should appear in the msgbox
-        //const QDateTime srcDt = QDateTime::fromTime_t( srcTime );
-        const QDateTime destDt = QDateTime::fromTime_t( destTime );
-        // Possible improvement: only show the time if date is today
-        const QString timeStr = KGlobal::locale()->formatDateTime( destDt, true \
                /*short*/ );
-        return KMessageBox::warningContinueCancel(
-            0 /*TODO parent*/,
-            i18n( "The file %1 was copied from %2, but since then it has apparently \
                been modified at %3.\n"
-                  "Undoing the copy will delete the file, and all modifications will \
                be lost.\n"
-                  "Are you sure you want to delete %4?", dest.pathOrUrl(), \
                src.pathOrUrl(), timeStr, dest.pathOrUrl() ),
-            i18n( "Undo File Copy Confirmation" ),
-            KStandardGuiItem::cont(),
-            QString(),
-            KMessageBox::Notify | KMessageBox::Dangerous ) == KMessageBox::Continue;
-    }
-};
-
 class KonqUndoManager::KonqUndoManagerPrivate
 {
 public:
     KonqUndoManagerPrivate()
-        : m_uiInterface( new KonqUndoUiInterface ),
+        : m_uiInterface( new KonqUndoManager::UiInterface( 0 /*TODO*/ ) ),
           m_undoJob( 0 )
     {
     }
@@ -685,5 +658,32 @@
     d->m_uiInterface = ui;
 }
 
+KonqUndoManager::UiInterface::UiInterface( QWidget* )
+{
+    // TODO store widget
+}
+
+void KonqUndoManager::UiInterface::jobError( KIO::Job* job )
+{
+    job->ui()->showErrorMessage();
+}
+
+bool KonqUndoManager::UiInterface::copiedFileWasModified( const KUrl& src, const \
KUrl& dest, time_t srcTime, time_t destTime ) { +    Q_UNUSED( srcTime ); // not sure \
it should appear in the msgbox +    //const QDateTime srcDt = QDateTime::fromTime_t( \
srcTime ); +    const QDateTime destDt = QDateTime::fromTime_t( destTime );
+    // Possible improvement: only show the time if date is today
+    const QString timeStr = KGlobal::locale()->formatDateTime( destDt, true \
/*short*/ ); +    return KMessageBox::warningContinueCancel(
+        0 /*TODO parent*/,
+        i18n( "The file %1 was copied from %2, but since then it has apparently been \
modified at %3.\n" +              "Undoing the copy will delete the file, and all \
modifications will be lost.\n" +              "Are you sure you want to delete %4?", \
dest.pathOrUrl(), src.pathOrUrl(), timeStr, dest.pathOrUrl() ), +        i18n( "Undo \
File Copy Confirmation" ), +        KStandardGuiItem::cont(),
+        QString(),
+        KMessageBox::Notify | KMessageBox::Dangerous ) == KMessageBox::Continue;
+}
+
 #include "konq_undo.moc"
 #include "konq_undo_p.moc"
--- trunk/KDE/kdebase/libkonq/konq_undo.h #627155:627156
@@ -54,15 +54,19 @@
   class LIBKONQ_EXPORT UiInterface
   {
   public:
+    UiInterface( QWidget* );
     virtual ~UiInterface() {}
 
-    virtual void jobError( KIO::Job* job ) = 0;
+    /**
+     * Called when an undo job errors; default implementation displays a message \
box. +     */
+    virtual void jobError( KIO::Job* job );
 
     /**
      * Called when dest was modified since it was copied from src.
      * Return true if we should proceed with deleting dest.
      */
-    virtual bool copiedFileWasModified( const KUrl& src, const KUrl& dest, time_t \
srcTime, time_t destTime ) = 0; +    virtual bool copiedFileWasModified( const KUrl& \
src, const KUrl& dest, time_t srcTime, time_t destTime );  };
 
   /**
--- trunk/KDE/kdebase/libkonq/tests/konqundomanagertest.cpp #627155:627156
@@ -118,7 +118,7 @@
 class TestUiInterface : public KonqUndoManager::UiInterface
 {
 public:
-    TestUiInterface() {}
+    TestUiInterface() : KonqUndoManager::UiInterface(0) {}
     virtual void jobError( KIO::Job* job ) {
         kFatal() << job->errorString() << endl;
     }


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

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