ooo-build r13124 - trunk/patches/dev300



Author: brosenk
Date: Wed Jul  9 10:48:05 2008
New Revision: 13124
URL: http://svn.gnome.org/viewvc/ooo-build?rev=13124&view=rev

Log:
Assorted kde4-fpicker fixes


Modified:
   trunk/patches/dev300/kde4-fpicker.diff

Modified: trunk/patches/dev300/kde4-fpicker.diff
==============================================================================
--- trunk/patches/dev300/kde4-fpicker.diff	(original)
+++ trunk/patches/dev300/kde4-fpicker.diff	Wed Jul  9 10:48:05 2008
@@ -1,5 +1,5 @@
---- ./config_office/configure.in.ark	2008-06-14 15:28:05.682810320 +0200
-+++ ./config_office/configure.in	2008-06-14 15:28:32.734780743 +0200
+--- config_office/configure.in.ark	2008-06-14 15:28:05.682810320 +0200
++++ config_office/configure.in	2008-06-14 15:28:32.734780743 +0200
 @@ -5655,7 +5655,7 @@ your KDE installation by exporting KDEDI
      fi
  
@@ -9,8 +9,8 @@
      KDE_LIBS="-L$kde_libdir -L$qt_libdir -lkdeui -lkdecore -lQtCore -lQtGui"
  fi
  AC_SUBST(KDE_CFLAGS)
---- ./fpicker/source/unx/kde/kdecommandthread.cxx.ark	2008-06-16 09:22:16.469786207 +0200
-+++ ./fpicker/source/unx/kde/kdecommandthread.cxx	2008-06-16 14:39:35.567978377 +0200
+--- fpicker/source/unx/kde/kdecommandthread.cxx.fpicker-kde4~	2008-07-09 12:43:02.378694846 +0200
++++ fpicker/source/unx/kde/kdecommandthread.cxx	2008-07-09 12:43:10.996967838 +0200
 @@ -55,6 +55,7 @@
   *  All Rights Reserved.
   *
@@ -70,8 +70,8 @@
          }
          else
              qBuffer.append( *pUnicode );
---- ./fpicker/source/unx/kde/kdecommandthread.hxx.ark	2008-06-14 15:44:59.451826118 +0200
-+++ ./fpicker/source/unx/kde/kdecommandthread.hxx	2008-06-16 09:50:23.678817863 +0200
+--- fpicker/source/unx/kde/kdecommandthread.hxx.fpicker-kde4~	2008-07-09 12:43:02.380696287 +0200
++++ fpicker/source/unx/kde/kdecommandthread.hxx	2008-07-09 12:43:11.347946664 +0200
 @@ -55,6 +55,7 @@
   *  All Rights Reserved.
   *
@@ -100,9 +100,9 @@
  };
  
  class CommandThread : public QThread
---- ./fpicker/source/unx/kde/kdefilepicker.cxx.ark	2008-06-16 14:51:49.116796955 +0200
-+++ ./fpicker/source/unx/kde/kdefilepicker.cxx	2008-06-19 10:34:55.496658199 +0200
-@@ -64,14 +64,10 @@
+--- fpicker/source/unx/kde/kdefilepicker.cxx.fpicker-kde4~	2008-07-09 12:43:02.383694504 +0200
++++ fpicker/source/unx/kde/kdefilepicker.cxx	2008-07-09 12:43:11.853967122 +0200
+@@ -64,14 +64,11 @@
  
  #include <qcheckbox.h>
  #include <qcombobox.h>
@@ -114,19 +114,30 @@
  #include <qpushbutton.h>
  #include <qregexp.h>
 -#include <qvbox.h>
++#include <QTemporaryFile>
  
  #ifdef QT_NO_EMIT
  #define emit
-@@ -95,24 +91,41 @@
+@@ -84,7 +81,6 @@
+ #include <kio/netaccess.h>
+ #include <klocale.h>
+ #include <kmessagebox.h>
+-#include <ktempfile.h>
+ 
+ #include <algorithm>
+ #include <iostream>
+@@ -94,25 +90,42 @@
+ //////////////////////////////////////////////////////////////////////////
  
  FileDialog::FileDialog( const QString &startDir, const QString &filter,
-         QWidget *parent, const char *name )
+-        QWidget *parent, const char *name )
 -    : KFileDialog( startDir, filter, parent, name, true, m_pCustomWidget = new QVBox() ),
 -      m_pCombosAndButtons( new QHBox( m_pCustomWidget ) ),
 -      m_pLabels( new QVBox( m_pCombosAndButtons ) ),
 -      m_pComboBoxes( new QVBox( m_pCombosAndButtons ) ),
 -      m_pPushButtons( new QVBox( m_pCombosAndButtons ) ),
 -      m_pCheckBoxes( new QGrid( 2, m_pCustomWidget ) ),
++        QWidget *parent )
 +    : KFileDialog( startDir, filter, parent, m_pCustomWidget = new QWidget() ), m_pCustomWidgetLayout( new QVBoxLayout(m_pCustomWidget) ),
 +      m_pCombosAndButtons( new QWidget( m_pCustomWidget ) ),
 +      m_pCombosAndButtonsLayout( new QHBoxLayout( m_pCombosAndButtons ) ),
@@ -263,24 +274,35 @@
  
                          qSelectedURL = addExtension( qLocalSelectedURL.url() );
                          QString qProtocol( qLocalSelectedURL.protocol() );
-@@ -382,7 +385,9 @@ void FileDialog::appendControl( const QS
+@@ -338,7 +341,7 @@ void FileDialog::customEvent( QCustomEve
+                                                                  i18n( "A file named \"%1\" already exists. "
+                                                                      "Are you sure you want to overwrite it?" ).arg( qFileName ),
+                                                                  i18n( "Overwrite File?" ),
+-                                                                 i18n( "Overwrite" ), KStdGuiItem::cancel() ) == KMessageBox::Yes );
++                                                                 KGuiItem(i18n( "Overwrite" )), KStandardGuiItem::cancel() ) == KMessageBox::Yes );
+                             }
+                             else if ( !isSupportedProtocol( qProtocol ) )
+                             {
+@@ -382,7 +385,10 @@ void FileDialog::appendControl( const QS
  
      if ( rType == "checkbox" )
      {
 -        QCheckBox *pCheckBox = new QCheckBox( qLabel, m_pCheckBoxes, rId.utf8() );
-+        QCheckBox *pCheckBox = new QCheckBox( qLabel, m_pCheckBoxes, rId.toUtf8() );
++        QCheckBox *pCheckBox = new QCheckBox( qLabel, m_pCheckBoxes );
++	pCheckBox->setObjectName(rId);
 +	m_pCheckBoxesLayout->addWidget(pCheckBox, m_pCheckBoxY, m_pCheckBoxX);
 +	m_pCheckBoxX++; if(m_pCheckBoxX==2) { m_pCheckBoxY++; m_pCheckBoxX=0; }
  
          pCheckBox->setEnabled( true );
          pCheckBox->setChecked( false );
-@@ -390,23 +395,26 @@ void FileDialog::appendControl( const QS
+@@ -390,33 +396,35 @@ void FileDialog::appendControl( const QS
      else if ( rType == "listbox" )
      {
          QLabel *pComboLabel = new QLabel( qLabel, m_pLabels );
 -        QComboBox *pComboBox = new QComboBox( m_pComboBoxes, rId.utf8() );
 +	m_pLabelsLayout->addWidget(pComboLabel);
-+        QComboBox *pComboBox = new QComboBox( m_pComboBoxes, rId.toUtf8() );
++        QComboBox *pComboBox = new QComboBox( m_pComboBoxes );
++	pComboBox->setObjectName(rId);
 +	m_pComboBoxesLayout->addWidget(pComboBox);
  
          pComboLabel->setBuddy( pComboBox );
@@ -289,7 +311,8 @@
      else if ( rType == "pushbutton" )
      {
 -        QPushButton *pPushButton = new QPushButton( qLabel, m_pPushButtons, rId.utf8() );
-+        QPushButton *pPushButton = new QPushButton( qLabel, m_pPushButtons, rId.toUtf8() );
++        QPushButton *pPushButton = new QPushButton( qLabel, m_pPushButtons );
++	pPushButton->setObjectName(rId);
 +	m_pPushButtonsLayout->addWidget(pPushButton);
          pPushButton->setEnabled( true );
      }
@@ -300,12 +323,23 @@
 -    QObjectList *pList = m_pCustomWidget->queryList();
 -    QCString qName( rId.utf8() );
 -    QObjectList::const_iterator it = pList->begin();
-+    QList<QObject*> *pList = m_pCustomWidget->queryList();
-+    QCString qName( rId.toUtf8() );
-+    QList<QObject*>::const_iterator it = pList->begin();
++    QList<QObject*> const &pList = qFindChildren<QObject*>(m_pCustomWidget);
++    QList<QObject*>::const_iterator it = pList.begin();
      
-     for ( ; it != pList->end() && qName != (*it)->name(); ++it )
+-    for ( ; it != pList->end() && qName != (*it)->name(); ++it )
++    for ( ; it != pList.end() && rId != (*it)->objectName(); ++it )
          ;
+ 
+     QWidget *pWidget = NULL;
+-    if ( it != pList->end() )
++    if ( it != pList.end() )
+         pWidget = static_cast< QWidget* >( *it );
+     
+-    delete pList;
+-
+     return pWidget;
+ }
+ 
 @@ -425,7 +433,7 @@ void FileDialog::enableControl( const QS
      QWidget *pWidget = findControl( rId );
  
@@ -315,7 +349,40 @@
  }
  
  void FileDialog::getValue( const QString &rId, const QString &rAction )
-@@ -488,7 +496,7 @@ void FileDialog::setValue( const QString
+@@ -437,7 +445,7 @@ void FileDialog::getValue( const QString
+ 
+     if ( pWidget )
+     {
+-        QCString qClassName = pWidget->className();
++        QString qClassName = pWidget->metaObject()->className();
+         if ( qClassName == "QCheckBox" )
+         {
+             QCheckBox *pCheckBox = static_cast< QCheckBox* >( pWidget );
+@@ -456,7 +464,7 @@ void FileDialog::getValue( const QString
+                 for ( int nIdx = 0; nIdx < pComboBox->count(); ++nIdx )
+                 {
+                     qString.append( ' ' );
+-                    appendEscaped( qString, pComboBox->text( nIdx ) );
++                    appendEscaped( qString, pComboBox->itemText( nIdx ) );
+                 }
+             }
+             else if ( rAction == "getSelectedItem" )
+@@ -467,7 +475,7 @@ void FileDialog::getValue( const QString
+             else if ( rAction == "getSelectedItemIndex" )
+             {
+                 qString.append( " int " );
+-                qString.append( QString().setNum( pComboBox->currentItem() ) );
++                qString.append( QString().setNum( pComboBox->currentIndex() ) );
+             }
+             // TODO getHelpURL
+         }
+@@ -483,12 +491,12 @@ void FileDialog::setValue( const QString
+ 
+     if ( pWidget )
+     {
+-        QCString qClassName = pWidget->className();
++        QString qClassName = pWidget->metaObject()->className();
+         if ( qClassName == "QCheckBox" )
          {
              QCheckBox *pCheckBox = static_cast< QCheckBox* >( pWidget );
  
@@ -324,9 +391,55 @@
              pCheckBox->setChecked( bValue );
          }
          else if ( qClassName == "QComboBox" )
-@@ -583,7 +591,7 @@ QString FileDialog::addExtension( const 
+@@ -497,11 +505,11 @@ void FileDialog::setValue( const QString
+             if ( rAction == "addItem" )
+             {
+                 if ( !rValue.isEmpty() )
+-                    pComboBox->insertItem( rValue.front() );
++                    pComboBox->addItem( rValue.front() );
+             }
+             else if ( rAction == "addItems" )
+             {
+-                pComboBox->insertStringList( rValue );
++                pComboBox->addItems( rValue );
+             }
+             else if ( rAction == "deleteItem" )
+             {
+@@ -515,7 +523,7 @@ void FileDialog::setValue( const QString
+             else if ( rAction == "setSelectedItem" )
+             {
+                 if ( !rValue.isEmpty() )
+-                    pComboBox->setCurrentItem( rValue.front().toInt() );
++                    pComboBox->setCurrentIndex( rValue.front().toInt() );
+             }
+             // FIXME setHelpURL is ignored
+         }
+@@ -566,24 +574,24 @@ QString FileDialog::addExtension( const 
+     QString qExtension;
  
-             int nIdx = (*it).find( '.', ::std::max( nUnwanted, 0 ) );
+     QWidget *pExtensionWidget = findControl( "100" ); // CHECKBOX_AUTOEXTENSION
+-    QCheckBox *pExtensionCB = pExtensionWidget? static_cast< QCheckBox* >( pExtensionWidget->qt_cast( "QCheckBox" ) ): NULL;
++    QCheckBox *pExtensionCB = pExtensionWidget? qobject_cast< QCheckBox* >( pExtensionWidget ): NULL;
+     if ( pExtensionCB && pExtensionCB->isChecked() )
+     {
+         // FIXME: qFilter can be a MIME; we ignore it now...
+-        QStringList qFilterList = QStringList::split( " ", currentFilter() );
++        QStringList qFilterList = currentFilter().split( " " );
+         for ( QStringList::const_iterator it = qFilterList.begin();
+               qExtension.isEmpty() && it != qFilterList.end();
+               ++it )
+         {
+-            int nUnwanted = (*it).findRev( '*' );
++            int nUnwanted = (*it).lastIndexOf( '*' );
+             if ( nUnwanted < 0 )
+-                nUnwanted = (*it).findRev( '?' );
++                nUnwanted = (*it).lastIndexOf( '?' );
+             else
+-                nUnwanted = ::std::max( nUnwanted, (*it).find( '?', nUnwanted ) );
++                nUnwanted = ::std::max( nUnwanted, (*it).indexOf( '?', nUnwanted ) );
+ 
+-            int nIdx = (*it).find( '.', ::std::max( nUnwanted, 0 ) );
++            int nIdx = (*it).indexOf( '.', ::std::max( nUnwanted, 0 ) );
              if ( nIdx >= 0 )
 -                qExtension = (*it).mid( nIdx ).lower();
 +                qExtension = (*it).mid( nIdx ).toLower();
@@ -342,7 +455,7 @@
  {
  #if KDE_IS_VERSION(3,5,0)
 -    KURL qMostLocalURL( KIO::NetAccess::mostLocalURL( rURL, const_cast<FileDialog*>( this ) ) );
-+    KUrl qMostLocalURL( KIO::NetAccess::mostLocalURL( rURL, const_cast<FileDialog*>( this ) ) );
++    KUrl qMostLocalURL( KIO::NetAccess::mostLocalUrl( rURL, const_cast<FileDialog*>( this ) ) );
      if ( qMostLocalURL.isLocalFile() )
          return qMostLocalURL;
      else
@@ -350,34 +463,48 @@
          // Terrible hack to get even non-existing media:// files right
          qMostLocalURL.cd( ".." );
 -        KURL qMostLocalPath( KIO::NetAccess::mostLocalURL( qMostLocalURL, const_cast<FileDialog*>( this ) ) );
-+        KUrl qMostLocalPath( KIO::NetAccess::mostLocalURL( qMostLocalURL, const_cast<FileDialog*>( this ) ) );
++        KUrl qMostLocalPath( KIO::NetAccess::mostLocalUrl( qMostLocalURL, const_cast<FileDialog*>( this ) ) );
          if ( qMostLocalPath.isLocalFile() )
          {
              qMostLocalPath.addPath( rURL.fileName() );
-@@ -641,7 +649,7 @@ KURL FileDialog::mostLocalURL( const KUR
+@@ -640,22 +648,22 @@ KURL FileDialog::mostLocalURL( const KUR
+ 
  QString FileDialog::localCopy( const QString &rFileName ) const
  {
-     // 106 == MIB enum for UTF-8
+-    // 106 == MIB enum for UTF-8
 -    KURL qLocalURL = mostLocalURL( KURL( rFileName, 106 ) );
-+    KUrl qLocalURL = mostLocalURL( KUrl( rFileName, 106 ) );
++    KUrl qLocalURL = mostLocalURL( KUrl( rFileName ) );
      if ( qLocalURL.isLocalFile() )
          return qLocalURL.url();
  
-@@ -652,7 +660,7 @@ QString FileDialog::localCopy( const QSt
-         nExtensionPos = rFileName.find( '.' );
+-    int nExtensionPos = rFileName.findRev( '/' );
++    int nExtensionPos = rFileName.lastIndexOf( '/' );
+     if ( nExtensionPos >= 0 )
+-        nExtensionPos = rFileName.find( '.', nExtensionPos );
++        nExtensionPos = rFileName.indexOf( '.', nExtensionPos );
+     else
+-        nExtensionPos = rFileName.find( '.' );
++        nExtensionPos = rFileName.indexOf( '.' );
  
-     KTempFile qTempFile( QString::null, ( nExtensionPos < 0 )? QString(): rFileName.mid( nExtensionPos ) );
+-    KTempFile qTempFile( QString::null, ( nExtensionPos < 0 )? QString(): rFileName.mid( nExtensionPos ) );
 -    KURL qDestURL;
+-    qDestURL.setPath( qTempFile.name() );
++    QTemporaryFile qTempFile( QString("ooo-temp-XXXXXX.") + (( nExtensionPos < 0 )? QString(): rFileName.mid( nExtensionPos )) );
++    qTempFile.setAutoRemove(false);
 +    KUrl qDestURL;
-     qDestURL.setPath( qTempFile.name() );
++    qDestURL.setPath( qTempFile.fileName() );
  
-     if ( !KIO::NetAccess::file_copy( rFileName, qDestURL, 0600, true, false, NULL ) )
+-    if ( !KIO::NetAccess::file_copy( rFileName, qDestURL, 0600, true, false, NULL ) )
++    if ( !KIO::NetAccess::file_copy( rFileName, qDestURL ) )
+     {
+         KMessageBox::error( 0, KIO::NetAccess::lastErrorString() );
+         return QString::null;
 @@ -689,10 +697,10 @@ void FileDialog::sendCommand( const QStr
  #endif
  
      //m_aOutputStream << rCommand << endl;
 -    ::std::cout << rCommand.utf8() << ::std::endl;
-+    ::std::cout << rCommand.toUtf8() << ::std::endl;
++    ::std::cout << rCommand.toUtf8().data() << ::std::endl;
  }
  
 -void FileDialog::appendURL( QString &rBuffer, const KURL &rURL )
@@ -385,8 +512,42 @@
  {
      // From Martin Kretzschmar:
      // file:///path/to/test%E0.odt is not a valid URL from OOo's point of
---- ./fpicker/source/unx/kde/kdefilepicker.hxx.ark	2008-06-16 14:51:18.703910550 +0200
-+++ ./fpicker/source/unx/kde/kdefilepicker.hxx	2008-06-16 16:28:26.293921027 +0200
+@@ -701,7 +709,7 @@ void FileDialog::appendURL( QString &rBu
+     // (which file:///path/test%E0.odt is not).
+     // Cf. the comment in sal/inc/osl/file.h.
+     // 106 == MIB enum for UTF-8
+-    QString qUrlStr = addExtension( rURL.url( 0, 106 ) );
++    QString qUrlStr = addExtension( rURL.url( KUrl::RemoveTrailingSlash ) );
+ 
+     if ( !isExecuting() && !isSupportedProtocol( rURL.protocol() ) )
+         qUrlStr = localCopy( qUrlStr );
+@@ -747,19 +755,19 @@ QString FileDialog::escapeString( const 
+ 
+ void FileFilterComboHack::setCurrentFilter( const QString& filter )
+ {
+-    setCurrentText( filter );
++    setEditText( filter );
+     filterChanged();
+ 
+     // Workaround for 'Filter name (*.blah)' vs. 'Filter name'
+-    if ( currentText() != text( currentItem() ) )
++    if ( currentText() != itemText( currentIndex() ) )
+     {
+         int nItem = 0;
+-        for ( ; nItem < count() && !text( nItem ).startsWith( filter ); ++nItem );
++        for ( ; nItem < count() && !itemText( nItem ).startsWith( filter ); ++nItem );
+ 
+         if ( nItem < count() )
+-            setCurrentItem( nItem );
++            setCurrentIndex( nItem );
+         else
+-            setCurrentItem( 0 );
++            setCurrentIndex( 0 );
+ 
+         filterChanged();
+     }
+--- fpicker/source/unx/kde/kdefilepicker.hxx.fpicker-kde4~	2008-07-09 12:43:02.385697133 +0200
++++ fpicker/source/unx/kde/kdefilepicker.hxx	2008-07-09 12:43:12.146967279 +0200
 @@ -65,9 +65,10 @@
  #include <kfiledialog.h>
  #include <kfilefiltercombo.h>
@@ -434,6 +595,15 @@
  
      FilterList                  m_aFilters;
  
+@@ -102,7 +111,7 @@ protected:
+ 
+ public:
+     FileDialog( const QString &startDir, const QString &filter,
+-                QWidget *parent, const char *name );
++                QWidget *parent = 0 );
+     virtual ~FileDialog();
+ 
+ protected:
 @@ -110,7 +119,7 @@ protected:
      virtual void                showEvent( QShowEvent *pEvent );
      void                        updateCustomWidgetLayout();



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]