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

List:       kde-commits
Subject:    branches/work/kviewshell-0.7/kviewshell
From:       Wilfried Huss <Wilfried.Huss () gmx ! at>
Date:       2006-06-21 20:26:11
Message-ID: 1150921571.882570.7990.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 553715 by whuss:

Since we don't support format conversion using "save as", 
only show the file format of the current file in the save as dialog,
not all supported file formats of the active plugin.

This makes KMultiPage::fileFormat() unnecessary.

 M  +0 -10     plugins/djvu/djvumultipage.cpp  
 M  +0 -7      plugins/djvu/djvumultipage.h  
 M  +0 -8      plugins/dvi/kdvi_multipage.cpp  
 M  +0 -3      plugins/dvi/kdvi_multipage.h  
 M  +0 -10     plugins/fax/faxmultipage.cpp  
 M  +0 -7      plugins/fax/faxmultipage.h  
 M  +0 -9      plugins/pdf/pdfMultipage.cpp  
 M  +0 -7      plugins/pdf/pdfMultipage.h  
 M  +0 -11     plugins/ps/psMultipage.cpp  
 M  +0 -7      plugins/ps/psMultipage.h  
 M  +0 -13     shell/kmultipage.h  
 M  +5 -2      shell/kviewpart.cpp  
 M  +6 -0      shell/kviewpart.h  


--- branches/work/kviewshell-0.7/kviewshell/plugins/djvu/djvumultipage.cpp \
#553714:553715 @@ -121,16 +121,6 @@
   enableActions(r);
 }
 
-QStringList DjVuMultiPage::fileFormats() const
-{
-  /* This list is used in the file selection dialog when the file is
-     saved */
-  QStringList r;
-  r << i18n("*.djvu|DjVu file (*.djvu)");
-  return r;
-}
-
-
 void DjVuMultiPage::setRenderMode(int mode)
 {
   // Save renderMode for future uses
--- branches/work/kviewshell-0.7/kviewshell/plugins/djvu/djvumultipage.h \
#553714:553715 @@ -105,13 +105,6 @@
 
   virtual void setFile(bool r);
 
-  /** List of file formats for file saving
-  
-  This method returns the list of supported file formats for saving
-  the file.
-  */
-  virtual QStringList fileFormats() const;
-
   /** Author information
  
   This member returns a structure that contains information about the
--- branches/work/kviewshell-0.7/kviewshell/plugins/dvi/kdvi_multipage.cpp \
#553714:553715 @@ -156,14 +156,6 @@
 }
 
 
-QStringList KDVIMultiPage::fileFormats() const
-{
-  QStringList r;
-  r << i18n("*.dvi *.DVI|TeX Device Independent Files (*.dvi)");
-  return r;
-}
-
-
 void KDVIMultiPage::addConfigDialogs(KConfigDialog* configDialog)
 {
   static optionDialogFontsWidget* fontConfigWidget = 0;
--- branches/work/kviewshell-0.7/kviewshell/plugins/dvi/kdvi_multipage.h \
#553714:553715 @@ -24,9 +24,6 @@
 
 // Interface definition start ------------------------------------------------
 
-  /// returns the list of supported file formats
-  virtual QStringList fileFormats() const;
-
   virtual void setFile(bool r);
 
   virtual void print();
--- branches/work/kviewshell-0.7/kviewshell/plugins/fax/faxmultipage.cpp \
#553714:553715 @@ -66,14 +66,4 @@
 }
 
 
-QStringList FaxMultiPage::fileFormats() const
-{
-  /* This list is used in the file selection dialog when the file is
-     saved */
-  QStringList r;
-  r << i18n("*.g3|Fax (g3) file (*.g3)");
-  return r;
-}
-
-
 #include "faxmultipage.moc"
--- branches/work/kviewshell-0.7/kviewshell/plugins/fax/faxmultipage.h #553714:553715
@@ -97,13 +97,6 @@
   */
   virtual ~FaxMultiPage();
 
-  /** List of file formats for file saving
-  
-  This method returns the list of supported file formats for saving
-  the file.
-  */
-  virtual QStringList fileFormats() const;
-
   /** Author information
  
   This member returns a structure that contains information about the
--- branches/work/kviewshell-0.7/kviewshell/plugins/pdf/pdfMultipage.cpp \
#553714:553715 @@ -99,15 +99,6 @@
   docInfoAction->setEnabled(b);
 }
 
-QStringList PdfMultiPage::fileFormats() const
-{
-  /* This list is used in the file selection dialog when the file is
-     saved */
-  QStringList r;
-  r << i18n("*.pdf|Pdf file (*.pdf)");
-  return r;
-}
-
 /*
 DocumentWidget* PdfMultiPage::createDocumentWidget(PageView *parent, \
DocumentPageCache *cache)  {
--- branches/work/kviewshell-0.7/kviewshell/plugins/pdf/pdfMultipage.h #553714:553715
@@ -105,13 +105,6 @@
   */
   virtual ~PdfMultiPage();
 
-  /** List of file formats for file saving
-
-  This method returns the list of supported file formats for saving
-  the file.
-  */
-  virtual QStringList fileFormats() const;
-
   /** Author information
 
   This member returns a structure that contains information about the
--- branches/work/kviewshell-0.7/kviewshell/plugins/ps/psMultipage.cpp #553714:553715
@@ -76,15 +76,4 @@
 }
 
 
-QStringList PsMultiPage::fileFormats() const
-{
-  /* This list is used in the file selection dialog when the file is
-     saved */
-  QStringList r;
-  r << i18n("*.ps|Ps file (*.ps)");
-  r << i18n("*.eps|Enculapsed Postscript file (*.eps)");
-  return r;
-}
-
-
 #include "psMultipage.moc"
--- branches/work/kviewshell-0.7/kviewshell/plugins/ps/psMultipage.h #553714:553715
@@ -104,13 +104,6 @@
   */
   virtual ~PsMultiPage();
 
-  /** List of file formats for file saving
-
-  This method returns the list of supported file formats for saving
-  the file.
-  */
-  virtual QStringList fileFormats() const;
-
   /** Author information
 
   This member returns a structure that contains information about the
--- branches/work/kviewshell-0.7/kviewshell/shell/kmultipage.h #553714:553715
@@ -178,19 +178,6 @@
      sizes returned by sizeOfPage() are invalid. */
   virtual bool hasSpecifiedPageSizes() const {return renderer && \
renderer->hasSpecifiedPageSizes();}  
-  /** list of supported file formats, for saving
-
-  This member must return the list of supported file formats for
-  saving. These strings returned must be in the format explained in
-  the documentation to KFileDialog::setFilter(), e.g. ""*.cpp *.cxx
-  *.c++|C++ Source Files". The use of mimetype-filters is allowed, but
-  discouraged. Among other penalties, if a multipage gives a
-  mimetype-filter, e.g. "application/x-dvi", the open file dialog in
-  kviewshell will not allow the user to see and select compressed
-  dvi-files.
-  */
-  virtual QStringList fileFormats() const = 0;
-
   /// closes a file
   virtual bool closeURL();
 
--- branches/work/kviewshell-0.7/kviewshell/shell/kviewpart.cpp #553714:553715
@@ -751,6 +751,9 @@
 
   mimetype = KMimeType::findByURL(tmpFileURL);
 
+  // Build the mimetype filter for this file, used by saveAs()
+  mimeTypeFilter = mimetype->patterns().join(" ") + "|" + mimetype->comment();
+
   // Search for a plugin that supports the needed mimetype.
   KTrader::OfferList offers = KTrader::self()->query(
     QString::fromLatin1("KViewShell/MultiPage"),
@@ -877,7 +880,7 @@
     
     // Remember the name of the part. So only need to switch if really necessary.
     multiPageLibrary = service->library();
-    
+
     if (oldMultiPage != 0) {
       factory()->removeClient(oldMultiPage);
       delete oldMultiPage;
@@ -1630,7 +1633,7 @@
     return;
   }
 
-  QString fileName = KFileDialog::getSaveFileName(QString::null, \
multiPage->fileFormats().join("\n"), 0, i18n("Save File As")); +  QString fileName = \
KFileDialog::getSaveFileName(QString::null, mimeTypeFilter, 0, i18n("Save File As")); \
  if (QFile(fileName).exists()) {
     int r = KMessageBox::warningContinueCancel (0, i18n("<qt>The file %1 exists. Do \
                you want to overwrite that file?</qt>").arg(fileName),
--- branches/work/kviewshell-0.7/kviewshell/shell/kviewpart.h #553714:553715
@@ -308,6 +308,12 @@
   /* True if the KDE text to speech service is active. */
   bool KTTSisAvailable;
 
+  /* This contains the mime type filter of the current file, in the format
+     supported by KFileDialog.
+
+     see KFileDialog::setFilter() for details. */
+  QString mimeTypeFilter;
+
  private slots:
   /** For internal use the reload()-method. This is a dreadful
      hack. The problem we adress with this timer event is the


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

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