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

List:       kde-commits
Subject:    KDE/kdegraphics/kviewshell
From:       Wilfried Huss <Wilfried.Huss () gmx ! at>
Date:       2006-06-21 20:39:37
Message-ID: 1150922377.950249.9334.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 553718 by whuss:

port of commit 553715:

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  +4 -1      shell/kviewpart.cpp  
 M  +6 -0      shell/kviewpart.h  


--- trunk/KDE/kdegraphics/kviewshell/plugins/djvu/djvumultipage.cpp #553717:553718
@@ -124,16 +124,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
--- trunk/KDE/kdegraphics/kviewshell/plugins/djvu/djvumultipage.h #553717:553718
@@ -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
--- trunk/KDE/kdegraphics/kviewshell/plugins/dvi/kdvi_multipage.cpp #553717:553718
@@ -162,14 +162,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;
--- trunk/KDE/kdegraphics/kviewshell/plugins/dvi/kdvi_multipage.h #553717:553718
@@ -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();
--- trunk/KDE/kdegraphics/kviewshell/plugins/fax/faxmultipage.cpp #553717:553718
@@ -69,16 +69,6 @@
 }
 
 
-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;
-}
-
-
 void FaxMultiPage::print()
 {
   // Paranoid safety checks
--- trunk/KDE/kdegraphics/kviewshell/plugins/fax/faxmultipage.h #553717:553718
@@ -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;
-
   /** Re-implementation of the print method */
   virtual void print();
 
--- trunk/KDE/kdegraphics/kviewshell/plugins/pdf/pdfMultipage.cpp #553717:553718
@@ -101,15 +101,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)  {
   PdfWidget* documentWidget = new PdfWidget(parent, cache);
--- trunk/KDE/kdegraphics/kviewshell/plugins/pdf/pdfMultipage.h #553717:553718
@@ -103,13 +103,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
--- trunk/KDE/kdegraphics/kviewshell/plugins/ps/psMultipage.cpp #553717:553718
@@ -72,15 +72,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"
--- trunk/KDE/kdegraphics/kviewshell/plugins/ps/psMultipage.h #553717:553718
@@ -105,13 +105,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
--- trunk/KDE/kdegraphics/kviewshell/shell/kmultipage.h #553717:553718
@@ -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();
 
--- trunk/KDE/kdegraphics/kviewshell/shell/kviewpart.cpp #553717:553718
@@ -787,6 +787,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.
   KService::List offers = KServiceTypeTrader::self()->query(
     QString::fromLatin1("KViewShell/MultiPage"),
@@ -1669,7 +1672,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>", fileName),
--- trunk/KDE/kdegraphics/kviewshell/shell/kviewpart.h #553717:553718
@@ -302,6 +302,12 @@
      kmultipage.cpp, right before the timerEvent function. */
   int  timer_id;
 
+  /* 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