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

List:       koffice-devel
Subject:    [PATCH] A little more for KDE 3.1.x
From:       Nicolas Goutte <nicolasg () snafu ! de>
Date:       2003-10-25 16:35:25
[Download RAW message or body]

The attached patch is for the file koffice/lib/kofficecore/koMainWindow.cc

It gives back, to KOffice CVS HEAD compiled on KDE 3.1.x, the possibility to 
save to KOffice 1.1 format and to a directory, however now coded as 
application/x-tgz and text/xml. (Ugly GUI but not any risk anymore to lose 
the document by choosing the "empty file" entries.)

Of course this patch does not fix bug #66142, it is still part of a 
work-around.

Please check if there is anything that I would have missed. (Loading seems to 
work when choosing the KOffice format.)

I think that this patch will give the possibility to release a KOffice 1.3 
Beta 5 next week. (I am not sure if LukāĻ would want to call it RC 1. However 
it would be his choice.)

Have a nice day!
["patch2.diff" (text/x-diff)]

Index: koMainWindow.cc
===================================================================
RCS file: /home/kde/koffice/lib/kofficecore/koMainWindow.cc,v
retrieving revision 1.315
diff -u -r1.315 koMainWindow.cc
--- koMainWindow.cc	24 Oct 2003 14:42:48 -0000	1.315
+++ koMainWindow.cc	25 Oct 2003 16:26:19 -0000
@@ -84,6 +84,7 @@
                  bool modal)
         : KFileDialog( startDir, filter, parent, name, modal ) { }
 
+#if KDE_IS_VERSION(3,1,92)
     void setSpecialMimeFilter( QStringList& mimeFilter,
                                const QString& currentFormat, const int \
specialOutputFlag,  const QString& nativeFormat )
@@ -91,7 +92,6 @@
         Q_ASSERT( !mimeFilter.isEmpty() );
         Q_ASSERT( mimeFilter[0] == nativeFormat );
 
-#if KDE_IS_VERSION(3,1,92)
         // Insert two entries with native mimetypes, for the special entries.
         QStringList::Iterator mimeFilterIt = mimeFilter.at( 1 );
         mimeFilter.insert( mimeFilterIt /* before 1 -> after 0 */, 2, nativeFormat \
); @@ -120,21 +120,45 @@
             if (!compatString.isEmpty ())
                 filterWidget->changeItem (i18n ("%1 (%2 Compatible)").arg \
(mime->comment ()).arg (compatString), i);  }
+    }
+
 #else
+
+    QString m_nativeFormat;
+
+    void setSpecialMimeFilter( QStringList& mimeFilter,
+                               const QString& currentFormat, const int \
specialOutputFlag, +                               const QString& nativeFormat )
+    {
+        Q_ASSERT( !mimeFilter.isEmpty() );
+        Q_ASSERT( mimeFilter[0] == nativeFormat );
+
         // ### FIXME: KDE 3.1.x crashes on filterWidget->changeItem
         // ### FIXME:   So we must provide a hack to have back a minimum of \
                functionality.
         // ### FIXME:   (Saving to KOffice 1.1 format and to directory are not \
supported.)  
         // Insert two entries with native mimetypes, for the special entries.
         QStringList::Iterator mimeFilterIt = mimeFilter.at( 1 );
-        mimeFilter.insert( mimeFilterIt /* before 1 -> after 0 */, 2, \
"application/x-zerosize" ); +        mimeFilter.insert( mimeFilterIt, \
"application/x-tgz" ); +        mimeFilter.insert( mimeFilterIt, "text/xml" );
         // Fill in filter combo
         // Note: if currentFormat doesn't exist in mimeFilter, filterWidget
         //       will default to the first item (native format)
         setMimeFilter( mimeFilter, currentFormat.isEmpty() ? nativeFormat : \
                currentFormat );
-#endif
+        m_nativeFormat=nativeFormat;
+    }
+
+    QString currentMimeFilter() const // Note: this is not virtual!!!
+    {
+        const QString result ( KFileDialog::currentMimeFilter() );
+        if ( (result == "application/x-tgz") || (result == "text/xml"))
+            return m_nativeFormat;
+        else
+            return result;
     }
 
+#endif
+
     int specialEntrySelected()
     {
         int i = filterWidget->currentItem();
@@ -143,6 +167,7 @@
             return i;
         return 0;
     }
+
 };
 
 class KoMainWindowPrivate



_______________________________________________
koffice-devel mailing list
koffice-devel@mail.kde.org
http://mail.kde.org/mailman/listinfo/koffice-devel


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

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