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

List:       kde-commits
Subject:    kdenox/konq-embed/dropin
From:       Eva Brucherseifer <eva () kde ! org>
Date:       2006-04-24 17:51:12
Message-ID: 1145901072.322158.9143.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 533397 by eva:

Qtopia:
fixed file dialog to actually work
first entry is the Documents folder by default now


 M  +31 -6     kfiledialog.cpp  
 M  +4 -2      kfiledialog.h  
 M  +3 -3      khtml/khtml_ext.cpp  


--- trunk/kdenox/konq-embed/dropin/kfiledialog.cpp #533396:533397
@@ -67,7 +67,7 @@
 
     if ( qpefd->exec() == QDialog::Accepted )
     {
-        result = qpefd->selectedPath(); 
+        result = "file:" + qpefd->selectedPath() + qpefd->selectedFilename(); 
     }
 
     delete qpefd;
@@ -84,7 +84,7 @@
     QString result;
 
     if ( qpefd->exec() == QDialog::Accepted )
-        result = qpefd->selectedFile(); 
+        result = Qpefd->selectedFile(); 
 
     delete qpefd;
     return result;
@@ -166,7 +166,12 @@
 void QPEFileSaverWrapper::updateMemory()
 {
     memory.clear();
+    nameMap.clear();
 
+    memory.append("Documents");
+    nameMap["Documents"] = QPEApplication::documentDir();
+    
+
     // insert all removable disks and the home partion 
     const QList<FileSystem> &fs = storage->fileSystems();
     QListIterator<FileSystem> it ( fs );
@@ -175,11 +180,12 @@
     QString homeFsPath;
     for ( ; it.current(); ++it ){
         if ( (*it)->isRemovable() ) {
-        memory.append( (*it)->name() );
+            memory.append( (*it)->name() );
+            nameMap[(*it)->name()] = (*it)->path();
         } else if ( homeDir.contains( (*it)->path() ) &&
-            (*it)->path().length() > homeFsPath.length() ) {
-        homeFs = (*it)->name();
-        homeFsPath = (*it)->path();
+                (*it)->path().length() > homeFsPath.length() ) {
+            homeFs = (*it)->name();
+            homeFsPath = (*it)->path();
         }
     }
 
@@ -189,8 +195,14 @@
         homeFs = StorageInfo::tr("Internal Storage");
         homeFsPath = homeDir;
     }
+#ifdef QTOPIA_SIMULATOR
+    homeFs = StorageInfo::tr("Simulator Home Directory: %1").arg(homeDir);
+    homeFsPath = homeDir;  
+#endif
 
     memory.append( homeFs );
+    nameMap[homeFs] = homeFsPath;
+
 //    delete m_storageCombo->contextMenu;
 //    contextMenu = 0;
     m_storageCombo->clear();
@@ -198,5 +210,18 @@
 }
 
 
+QString QPEFileSaverWrapper::selectedPath() const 
+{ 
+    kdDebug() << "Selected Path: " << nameMap[m_storageCombo->currentText()] << endl;
+    return nameMap[m_storageCombo->currentText()]; 
+}
+
+QString QPEFileSaverWrapper::selectedFilename() const 
+{ 
+    kdDebug() << "Selected Filename: " << m_fileEdit->text() << endl;
+    return m_fileEdit->text(); 
+}
+
+
 #include "kfiledialog.moc"
 #endif
--- trunk/kdenox/konq-embed/dropin/kfiledialog.h #533396:533397
@@ -32,6 +32,7 @@
 
 #include <qcombobox.h>
 #include <qlineedit.h>
+#include <qmap.h>
 
 
 class KFileDialog
@@ -84,8 +85,8 @@
     QPEFileSaverWrapper( const QString& dir, QWidget *parent, const char *name = 0 );
     virtual ~QPEFileSaverWrapper();
 
-    QString selectedPath() const { return m_storageCombo->currentText(); }
-    QString selectedFilename() const { return m_fileEdit->text(); }
+    QString selectedPath() const;
+    QString selectedFilename() const;
 
 private slots:
 //    void fileSelected( const DocLnk &doc );
@@ -94,6 +95,7 @@
 private:
     StorageInfo *storage;
     QStringList memory;
+    QMap<QString, QString> nameMap;
 
     QComboBox* m_storageCombo;
     QLineEdit* m_fileEdit;
--- trunk/kdenox/konq-embed/dropin/khtml/khtml_ext.cpp #533396:533397
@@ -147,7 +147,6 @@
                                    const QMap<QString, QString> &metadata,
                                    long cacheId )
 {
-    kdDebug() << "saveURL 2 " << endl;
     if ( destURL.isValid() )
     {
         bool saved = false;
@@ -165,15 +164,16 @@
         if(!saved)
         {
             kdDebug() << "Saving file from " << url << " to " << destURL << endl;
-            KIO::TransferJob *job = KIO::file_copy( url, destURL, -1, true /*overwrite*/ );
+            KIO::TransferJob *job = KIO::file_copy( url, destURL, -1, true /*overwrite*/, false, true );
             job->setMetaData(metadata);
             job->addMetaData("MaxCacheSize", "0"); // Don't store in http cache.
-            job->addMetaData("cache", "cache"); // Use entry from cache if available.
+            job->addMetaData("cache", "cache"); // Use entry from cache if available. 
 //            job->setAutoErrorHandlingEnabled( true );  
         } //end if(!saved)
     }
 }
 
+
 #include "khtml_ext.moc"
 
 
[prev in list] [next in list] [prev in thread] [next in thread] 

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