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

List:       kde-commits
Subject:    [kdev-upload/frameworks] /: Port away from deprecated methods
From:       Jakub Caban <kuba () whyblack ! pl>
Date:       2014-09-30 21:43:24
Message-ID: E1XZ5Ce-00030o-Vf () scm ! kde ! org
[Download RAW message or body]

Git commit 286c82e4737c74b897ef19fd4c4eca0b860230e6 by Jakub Caban.
Committed on 30/09/2014 at 21:31.
Pushed by jcaban into branch 'frameworks'.

Port away from deprecated methods

REVIEW:120312

M  +12   -12   CMakeLists.txt
M  +3    -2    kdevuploadplugin.cpp
M  +5    -6    profilesfiletree.cpp
M  +3    -3    profilesfiletree.h
M  +6    -2    tests/CMakeLists.txt
M  +3    -6    tests/permissions.cpp
M  +33   -32   uploadjob.cpp
M  +2    -1    uploadpreferences.cpp
M  +3    -10   uploadpreferences.ui
M  +50   -23   uploadprofiledlg.cpp
M  +6    -6    uploadprofiledlg.h
M  +3    -4    uploadprofileitem.cpp
M  +3    -3    uploadprofileitem.h
M  +1    -2    uploadprofilemodel.cpp
M  +9    -8    uploadprojectmodel.cpp
M  +3    -3    uploadprojectmodel.h

http://commits.kde.org/kdev-upload/286c82e4737c74b897ef19fd4c4eca0b860230e6

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3428c80..4d73953 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -26,15 +26,14 @@ find_package(KDevPlatform ${KDEVPLATFORM_VERSION} REQUIRED)
 include_directories(${KDEVPLATFORM_INCLUDE_DIR})
 
 include_directories(
-   ${KDE4_INCLUDES}
    ${CMAKE_CURRENT_BINARY_DIR}
    ${CMAKE_CURRENT_SOURCE_DIR}
 )
 
-# add_subdirectory(tests)
+add_subdirectory(tests)
 
 #plugin
-set(kdevupload_PART_SRCS 
+set(kdevupload_PART_SRCS
    kdevuploadplugin.cpp
    allprofilesmodel.cpp
    profilesfiletree.cpp
@@ -57,16 +56,15 @@ add_library(kdevupload MODULE ${kdevupload_PART_SRCS})
 target_link_libraries(kdevupload
     KDev::Interfaces
     KDev::Project
-    
+    KDev::Serialization
+
     KF5::JobWidgets
     KF5::KCMUtils
     KF5::KIOCore
     KF5::KIOFileWidgets
     KF5::KIOWidgets
+    KF5::KIONTLM
     KF5::CoreAddons
-    
-    # TODO: remove
-    KF5::KDELibs4Support
 )
 
 install(TARGETS kdevupload  DESTINATION ${PLUGIN_INSTALL_DIR})
@@ -78,7 +76,7 @@ install(FILES  kdevupload.rc DESTINATION \
${DATA_INSTALL_DIR}/kdevupload)  
 #preferences-plugin
 # add_executable(location_recognition ${SRC} ${UIS_HDRS})
-set(uploadpreferences_PART_SRCS 
+set(uploadpreferences_PART_SRCS
    uploadpreferences.cpp
    uploadprofilemodel.cpp
    uploadprofileitem.cpp
@@ -91,14 +89,16 @@ add_library(kcm_kdev_upload ${uploadpreferences_PART_SRCS})
 
 target_link_libraries(kcm_kdev_upload
     KDev::Interfaces
-    
+    KDev::Util
+
     KF5::I18n
     KF5::KCMUtils
     KF5::Service
     KF5::Parts
-    
-    # TODO: remove
-    KF5::KDELibs4Support
+    KF5::KIOCore
+    KF5::KIOFileWidgets
+    KF5::KIOWidgets
+    KF5::KIONTLM
 )
 
 install(TARGETS kcm_kdev_upload  DESTINATION ${PLUGIN_INSTALL_DIR})
diff --git a/kdevuploadplugin.cpp b/kdevuploadplugin.cpp
index 5261978..54caa8a 100644
--- a/kdevuploadplugin.cpp
+++ b/kdevuploadplugin.cpp
@@ -33,6 +33,7 @@
 #include <interfaces/contextmenuextension.h>
 #include <project/projectmodel.h>
 #include <outputview/ioutputview.h>
+#include <serialization/indexedstring.h>
 
 #include "uploaddialog.h"
 #include "profilesfiletree.h"
@@ -159,7 +160,7 @@ void UploadPlugin::documentActivated(KDevelop::IDocument* doc)
         m_quickUploadCurrentFile->setEnabled(false);
         return;
     }
-    QList<KDevelop::ProjectFileItem*> files = project->filesForUrl(doc->url());
+    QList<KDevelop::ProjectFileItem*> files = \
project->filesForPath(KDevelop::IndexedString(doc->url()));  if (files.isEmpty()) {
         m_quickUploadCurrentFile->setEnabled(false);
         return;
@@ -275,7 +276,7 @@ void UploadPlugin::quickUploadCurrentFile()
     if (!doc) return;
     KDevelop::IProject* project = \
KDevelop::ICore::self()->projectController()->findProjectForUrl(doc->url());  if \
                (!project) return;
-    QList<KDevelop::ProjectFileItem*> files = project->filesForUrl(doc->url());
+    QList<KDevelop::ProjectFileItem*> files = \
project->filesForPath(KDevelop::IndexedString(doc->url()));  if (files.isEmpty()) \
return;  
     UploadProjectModel* model = new UploadProjectModel(project);
diff --git a/profilesfiletree.cpp b/profilesfiletree.cpp
index 2c19df0..45152f6 100644
--- a/profilesfiletree.cpp
+++ b/profilesfiletree.cpp
@@ -21,7 +21,6 @@
 
 #include <kdebug.h>
 #include <klocale.h>
-#include <kurl.h>
 #include <KDirOperator>
 #include <KFileWidget>
 #include <KActionCollection>
@@ -67,7 +66,7 @@ ProfilesFileTree::ProfilesFileTree(UploadPlugin* plugin, QWidget \
*parent)  m_tree->setView(KFile::Tree);
     connect(m_tree, SIGNAL(fileSelected(const KFileItem &)),
            SLOT(fileSelected(KFileItem)));
-    connect(m_tree, SIGNAL(urlEntered(KUrl)), SLOT(urlEntered(KUrl)), \
Qt::QueuedConnection); +    connect(m_tree, SIGNAL(urlEntered()), SLOT(urlEntered()), \
                Qt::QueuedConnection);
     connect(m_tree, SIGNAL(contextMenuAboutToShow(KFileItem,QMenu*)), \
SLOT(contextMenuAboutToShow(KFileItem,QMenu*)));  
     QAction* a = new QAction(i18n("&Copy URL"), this);
@@ -83,7 +82,7 @@ ProfilesFileTree::ProfilesFileTree(UploadPlugin* plugin, QWidget \
*parent)  
 void ProfilesFileTree::browseUrl()
 {
-    KUrl url;
+    QUrl url;
     if (m_tree->selectedItems().isEmpty()) {
         url = m_tree->url();
     } else {
@@ -94,7 +93,7 @@ void ProfilesFileTree::browseUrl()
 
 void ProfilesFileTree::copyUrl()
 {
-    KUrl url;
+    QUrl url;
     if (m_tree->selectedItems().isEmpty()) {
         url = m_tree->url();
     } else {
@@ -115,7 +114,7 @@ void ProfilesFileTree::contextMenuAboutToShow(KFileItem item, \
QMenu* menu)  }
 
 
-void ProfilesFileTree::urlEntered(const KUrl& url)
+void ProfilesFileTree::urlEntered()
 {
     profileIndexChanged(m_profilesCombo->currentIndex());
 }
@@ -149,7 +148,7 @@ void ProfilesFileTree::profileIndexChanged(int index)
     }
 }
 
-void ProfilesFileTree::openUrl(const KUrl& url)
+void ProfilesFileTree::openUrl(const QUrl& url)
 {
     kDebug(24000) << "openUrl" << url;
     KDevelop::ICore::self()->documentController()->openDocument(url);
diff --git a/profilesfiletree.h b/profilesfiletree.h
index c595f32..57c34c3 100644
--- a/profilesfiletree.h
+++ b/profilesfiletree.h
@@ -18,8 +18,8 @@ class QMenu;
 class QModelIndex;
 class QComboBox;
 class QLabel;
+class QUrl;
 
-class KUrl;
 class KDirOperator;
 class KFileItem;
 
@@ -48,7 +48,7 @@ private Q_SLOTS:
     /**
      * Open the Url in the editor
      */
-    void openUrl(const KUrl& url);
+    void openUrl(const QUrl& url);
 
     /**
      * Slot called when current profile has changed, sets the new root-url for
@@ -68,7 +68,7 @@ private Q_SLOTS:
     void modifyProfile();
 
     void fileSelected(const KFileItem& item);
-    void urlEntered(const KUrl&);
+    void urlEntered();
     void contextMenuAboutToShow(KFileItem,QMenu*);
     void copyUrl();
     void browseUrl();
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index f4bc1a8..aff18d9 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -1,6 +1,10 @@
 
 add_executable(permssions permissions.cpp)
 target_link_libraries(permssions
-    #TODO: port away
-    KF5::KDELibs4Support
+    Qt5::Core
+    Qt5::Widgets
+
+    KF5::JobWidgets
+    KF5::KIOCore
+    KF5::KIOWidgets
 )
diff --git a/tests/permissions.cpp b/tests/permissions.cpp
index 8735c8d..1837838 100644
--- a/tests/permissions.cpp
+++ b/tests/permissions.cpp
@@ -1,14 +1,11 @@
 #include <QDebug>
 #include <kio/job.h>
-#include <kio/netaccess.h>
 #include <QApplication>
 #include <kaboutdata.h>
 #include <kcomponentdata.h>
 
 int main(int argc, char **argv)
 {
-    KAboutData about( "permissions", "permissions", ki18n("permissions test"), "0.1" \
                );
-    KComponentData comonentData(&about);
     QApplication app(argc, argv);
 
     QStringList args;
@@ -18,9 +15,9 @@ int main(int argc, char **argv)
     if (args.count() != 2) {
         qFatal("Required parameters: source destination");
     }
-    qDebug() << KUrl(args[0]) << KUrl(args[1]);
-    KIO::FileCopyJob* job = KIO::file_copy(KUrl(args[0]), KUrl(args[1]), -1, \
                KIO::Overwrite | KIO::HideProgressInfo);
-    if (KIO::NetAccess::synchronousRun(job, 0)) {
+    qDebug() << QUrl::fromUserInput(args[0]) << QUrl::fromUserInput(args[1]);
+    KIO::Job* job = KIO::file_copy(QUrl::fromUserInput(args[0]), \
QUrl::fromUserInput(args[1]), -1, KIO::Overwrite | KIO::HideProgressInfo); +    if \
(job->exec()) {  qDebug() << "successfully copied";
         return 0;
     } else {
diff --git a/uploadjob.cpp b/uploadjob.cpp
index c58db45..ebe556b 100644
--- a/uploadjob.cpp
+++ b/uploadjob.cpp
@@ -14,6 +14,7 @@
 #include <QStandardItemModel>
 #include <QtWidgets/QProgressDialog>
 #include <QUrl>
+#include <QDir>
 
 #include <kconfiggroup.h>
 #include <kmessagebox.h>
@@ -23,13 +24,13 @@
 #include <kio/jobuidelegate.h>
 #include <kio/netaccess.h>
 #include <klocale.h>
-#include <kurl.h>
 #include <kjob.h>
 #include <kjobwidgets.h>
 
 #include <interfaces/iproject.h>
 #include <interfaces/iprojectcontroller.h>
 #include <project/projectmodel.h>
+#include <util/path.h>
 
 #include "uploadprojectmodel.h"
 
@@ -41,7 +42,6 @@ UploadJob::UploadJob(KDevelop::IProject* project, \
UploadProjectModel* model, QWi  m_progressDialog->setWindowTitle(i18n("Uploading \
files"));  m_progressDialog->setLabelText(i18n("Preparing..."));
     m_progressDialog->setModal(true);
-    m_progressDialog->setAutoClose(false);
 }
 
 UploadJob::~UploadJob()
@@ -64,7 +64,7 @@ void UploadJob::start()
                                 ->data(i, Qt::CheckStateRole).toInt());
         if (item->file() && checked != Qt::Unchecked) {
             KIO::UDSEntry entry;
-            if (KIO::NetAccess::stat(item->file()->url(), entry, m_progressDialog)) \
{ +            if (KIO::NetAccess::stat(item->path().toUrl(), entry, \
m_progressDialog)) {  sumSize += entry.numberValue(KIO::UDSEntry::UDS_SIZE);
             }
         }
@@ -84,7 +84,6 @@ void UploadJob::uploadNext()
     if (!m_uploadIndex.isValid()) {
         //last index reached - completed
         appendLog(i18n("Upload completed"));
-        m_progressDialog->close();
         emit uploadFinished();
         delete this;
         return;
@@ -100,15 +99,21 @@ void UploadJob::uploadNext()
 
     Qt::CheckState checked = static_cast<Qt::CheckState>(m_uploadProjectModel
                             ->data(m_uploadIndex, Qt::CheckStateRole).toInt());
-    KUrl url;
-    KUrl projectFolder(m_project->folder());
-    projectFolder.adjustPath(KUrl::AddTrailingSlash);
-    if (item->folder()) url = item->folder()->url();
-    else if (item->file()) url = item->file()->url();
+
+    KDevelop::Path url;
+
+    if (item->folder()) {
+        url = item->folder()->path();
+    } else if (item->file()) {
+        url = item->file()->path();
+    }
+
+    QString relativeUrl(m_project->path().relativePath(url));
+
     if (isQuickUpload() && checked == Qt::Unchecked) {
         appendLog(i18n("File was not modified for %1: %2",
                             m_uploadProjectModel->currentProfileName(),
-                            KUrl::relativeUrl(projectFolder, url)));
+                            relativeUrl));
     }
 
     if (!(item->file() || item->folder()) || checked == Qt::Unchecked) {
@@ -116,42 +121,40 @@ void UploadJob::uploadNext()
         return;
     }
 
-    KUrl dest = m_uploadProjectModel->currentProfileUrl();
-    dest.addPath(KUrl::relativeUrl(projectFolder, url));
-
+    QUrl dest = m_uploadProjectModel->currentProfileUrl().adjusted(QUrl::StripTrailingSlash);
 +    dest.setPath(dest.path() + "/" + relativeUrl);
     KIO::Job* job = 0;
 
     if (m_onlyMarkUploaded) {
         appendLog(i18n("Marked as uploaded for %1: %2",
                             m_uploadProjectModel->currentProfileName(),
-                            KUrl::relativeUrl(projectFolder, url)));
+                            relativeUrl));
         m_uploadProjectModel->profileConfigGroup()
-                .writeEntry(KUrl::relativeUrl(projectFolder, url),
+                .writeEntry(relativeUrl,
                             QDateTime::currentDateTime());
         uploadNext();
         return;
     } else if (item->file()) {
-        appendLog(KUrl::relativeUrl(projectFolder, url));
         appendLog(i18n("Uploading to %1: %2",
                             m_uploadProjectModel->currentProfileName(),
-                            KUrl::relativeUrl(projectFolder, url)));
-        kDebug() << "file_copy" << url << dest;
-        job = KIO::file_copy(url, dest, -1, KIO::Overwrite | KIO::HideProgressInfo);
-        m_progressDialog->setLabelText(i18n("Uploading %1...", \
KUrl::relativeUrl(projectFolder, url))); +                            relativeUrl));
+        kDebug() << "file_copy" << url.pathOrUrl() << dest;
+        job = KIO::file_copy(url.toUrl(), dest, -1, KIO::Overwrite | \
KIO::HideProgressInfo); +        m_progressDialog->setLabelText(i18n("Uploading \
%1...", relativeUrl));  } else if (item->folder()) {
         if (KIO::NetAccess::exists(dest, KIO::NetAccess::DestinationSide, \
                m_progressDialog)) {
-            appendLog(i18n("Directory in %1 already exists: %2", 
+            appendLog(i18n("Directory in %1 already exists: %2",
                                 m_uploadProjectModel->currentProfileName(),
-                                KUrl::relativeUrl(projectFolder, url)));
+                                relativeUrl));
             m_uploadProjectModel->profileConfigGroup()
-                    .writeEntry(KUrl::relativeUrl(projectFolder, url),
+                    .writeEntry(relativeUrl,
                                 QDateTime::currentDateTime());
             uploadNext();
             return;
         } else {
-            appendLog(i18n("Creating directory in %1: %2", 
+            appendLog(i18n("Creating directory in %1: %2",
                                 m_uploadProjectModel->currentProfileName(),
-                                KUrl::relativeUrl(projectFolder, url)));
+                                relativeUrl));
             kDebug() << "mkdir" << dest;
             job = KIO::mkdir(dest);
         }
@@ -190,22 +193,20 @@ void UploadJob::uploadResult(KJob* job)
             return;
         }
         appendLog(i18n("Upload error: %1", job->errorString()));
-        m_progressDialog->close();
-//TODO: Find out what next line doas as it crushes KDevelop
-//         qobject_cast<KIO::Job*>(job)->ui()->showErrorMessage();
+        qobject_cast<KIO::Job*>(job)->ui()->showErrorMessage();
         delete this;
         return;
     }
 
     KDevelop::ProjectBaseItem* item = m_uploadProjectModel->item(m_uploadIndex);
-    KUrl url;
+    QUrl url;
     if (item->file()) {
-        url = item->file()->url();
+        url = item->file()->path().toUrl();
     } else if (item->folder()) {
-        url = item->folder()->url();
+        url = item->folder()->path().toUrl();
     }
     m_uploadProjectModel->profileConfigGroup()
-        .writeEntry(KUrl::relativeUrl(m_project->folder(), url), \
QDateTime::currentDateTime()); +        \
.writeEntry(m_project->path().relativePath(KDevelop::Path(url)), \
QDateTime::currentDateTime());  m_uploadProjectModel->profileConfigGroup().sync();
 
     KIO::UDSEntry entry;
diff --git a/uploadpreferences.cpp b/uploadpreferences.cpp
index 0949c92..1fe0d72 100644
--- a/uploadpreferences.cpp
+++ b/uploadpreferences.cpp
@@ -21,6 +21,7 @@
 #include <interfaces/iplugincontroller.h>
 #include <interfaces/iprojectcontroller.h>
 #include <interfaces/iproject.h>
+#include <util/path.h>
 
 #include "uploadprofilemodel.h"
 #include "ui_uploadpreferences.h"
@@ -37,7 +38,7 @@ UploadPreferences::UploadPreferences( QWidget *parent, const \
QVariantList &args  {
     IProject* project = 0;
     Q_FOREACH (IProject* p, \
                KDevelop::ICore::self()->projectController()->projects()) {
-        if (p->projectFileUrl().path() == args.at(1).toString()) {
+        if (p->projectFile().path() == args.at(1).toString()) {
             project = p;
             break;
         }
diff --git a/uploadpreferences.ui b/uploadpreferences.ui
index ac4c679..09fa0b2 100644
--- a/uploadpreferences.ui
+++ b/uploadpreferences.ui
@@ -16,21 +16,21 @@
    <item row="0" column="1" >
     <layout class="QVBoxLayout" >
      <item>
-      <widget class="KPushButton" name="addProfileButton" >
+      <widget class="QPushButton" name="addProfileButton" >
        <property name="text" >
         <string>&amp;Add Profile</string>
        </property>
       </widget>
      </item>
      <item>
-      <widget class="KPushButton" name="removeProfileButton" >
+      <widget class="QPushButton" name="removeProfileButton" >
        <property name="text" >
         <string>&amp;Remove Profile</string>
        </property>
       </widget>
      </item>
      <item>
-      <widget class="KPushButton" name="modifyProfileButton" >
+      <widget class="QPushButton" name="modifyProfileButton" >
        <property name="text" >
         <string>&amp;Modify Profile</string>
        </property>
@@ -53,13 +53,6 @@
    </item>
   </layout>
  </widget>
- <customwidgets>
-  <customwidget>
-   <class>KPushButton</class>
-   <extends>QPushButton</extends>
-   <header>kpushbutton.h</header>
-  </customwidget>
- </customwidgets>
  <tabstops>
   <tabstop>profilesList</tabstop>
   <tabstop>addProfileButton</tabstop>
diff --git a/uploadprofiledlg.cpp b/uploadprofiledlg.cpp
index ff234bd..ac0fba2 100644
--- a/uploadprofiledlg.cpp
+++ b/uploadprofiledlg.cpp
@@ -11,21 +11,30 @@
 
 #include <QListWidgetItem>
 #include <KLocalizedString>
+#include <QFileDialog>
+#include <QDialog>
+#include <QDialogButtonBox>
+#include <QPushButton>
+#include <qglobal.h>
 
 #include <kdebug.h>
 #include <kprotocolmanager.h>
 #include <kprotocolinfo.h>
-#include <kurl.h>
-#include <kdirselectdialog.h>
-#include <kio/netaccess.h>
+#include <kio/statjob.h>
+#include <KJobWidgets>
 #include <kmessagebox.h>
 
 #include "ui_uploadprofiledlg.h"
 #include "uploadprofileitem.h"
 
 UploadProfileDlg::UploadProfileDlg(QWidget *parent)
-    : KDialog (parent)
+    : QDialog (parent)
 {
+    setWindowTitle(i18n("Upload Profile"));
+
+    QVBoxLayout *mainLayout = new QVBoxLayout;
+    setLayout(mainLayout);
+
     QWidget* widget = new QWidget(this);
     m_ui = new Ui::UploadProfileDlg();
     m_ui->setupUi(widget);
@@ -33,20 +42,27 @@ UploadProfileDlg::UploadProfileDlg(QWidget *parent)
     m_ui->browseButton->setIcon(QIcon::fromTheme("document-open"));
     connect(m_ui->browseButton, SIGNAL(clicked()), this, SLOT(browse()));
 
+    QDialogButtonBox *buttonBox = new \
QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel); +    QPushButton \
*okButton = buttonBox->button(QDialogButtonBox::Ok); +    okButton->setDefault(true);
+    okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
+
+    connect(buttonBox, SIGNAL(accepted()), this, SLOT(slotAcceptButtonClicked()));
+    connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
+
+    mainLayout->addWidget(widget);
+    mainLayout->addWidget(buttonBox);
+
     QStringList protocols = KProtocolInfo::protocols();
     protocols.sort();
     Q_FOREACH (QString p, protocols) {
-        KUrl u;
-        u.setProtocol(p);
+        QUrl u;
+        u.setScheme(p);
         if (KProtocolManager::supportsWriting(u) && \
KProtocolManager::supportsMakeDir(u)  && KProtocolManager::supportsDeleting(u)) {
             m_ui->comboProtocol->addItem(p);
         }
     }
-
-    setMainWidget(widget);
-    setCaption(i18n("Upload Profile"));
-    setButtons(KDialog::Close | KDialog::Ok);
 }
 
 UploadProfileDlg::~UploadProfileDlg()
@@ -69,9 +85,9 @@ int UploadProfileDlg::editProfile(UploadProfileItem* item)
     return result;
 }
 
-KUrl UploadProfileDlg::currentUrl()
+QUrl UploadProfileDlg::currentUrl()
 {
-    KUrl url;
+    QUrl url;
     url.setHost(m_ui->lineHost->text());
     url.setUserName(m_ui->lineUser->text());
     url.setPath(m_ui->linePath->text());
@@ -80,7 +96,7 @@ KUrl UploadProfileDlg::currentUrl()
     return url;
 }
 
-void UploadProfileDlg::updateUrl(const KUrl& url)
+void UploadProfileDlg::updateUrl(const QUrl& url)
 {
     m_ui->lineHost->setText(url.host());
     m_ui->lineUser->setText(url.userName());
@@ -96,19 +112,30 @@ void UploadProfileDlg::updateUrl(const KUrl& url)
 
 void UploadProfileDlg::browse()
 {
-    KDirSelectDialog dialog(currentUrl(), false, this);
-    if (dialog.exec() == QDialog::Accepted && dialog.url().isValid()) {
-        updateUrl(dialog.url());
+#if QT_VERSION >= 0x050400
+    QUrl chosenDir = QFileDialog::getExistingDirectoryUrl(this, QString(), \
currentUrl()); +#else
+    QFileDialog dialog(this);
+    dialog.setDirectoryUrl(currentUrl());
+    dialog.setOptions(QFileDialog::ShowDirsOnly);
+    dialog.exec();
+    QUrl chosenDir = dialog.selectedUrls().first();
+#endif
+    if(chosenDir.isValid()) {
+        updateUrl(chosenDir);
     }
 }
-void UploadProfileDlg::slotButtonClicked(int button) {
-    if (button == KDialog::Ok) {
-        if (!KIO::NetAccess::exists(currentUrl(), KIO::NetAccess::DestinationSide, \
                this)) {
-            KMessageBox::sorry(this, i18n("The specified URL does not exist."));
-            return;
-        }
+void UploadProfileDlg::slotAcceptButtonClicked()
+{
+    KIO::StatJob* statJob = KIO::stat(currentUrl());
+    statJob->setSide(KIO::StatJob::DestinationSide);
+    KJobWidgets::setWindow(statJob, this);
+    bool dirExists = statJob->exec();
+    if (!dirExists) {
+        KMessageBox::sorry(this, i18n("The specified URL does not exist."));
+        return;
     }
-    KDialog::slotButtonClicked(button);
+    QDialog::accept();
 }
 
 #include "uploadprofiledlg.moc"
diff --git a/uploadprofiledlg.h b/uploadprofiledlg.h
index d363190..2124a60 100644
--- a/uploadprofiledlg.h
+++ b/uploadprofiledlg.h
@@ -11,9 +11,9 @@
 #ifndef UPLOADPROFILEDLG_H
 #define UPLOADPROFILEDLG_H
 
-#include <kdialog.h>
+#include <QDialog>
 
-class KUrl;
+class QUrl;
 class QListWidgetItem;
 namespace Ui {
     class UploadProfileDlg;
@@ -23,7 +23,7 @@ class UploadProfileItem;
 /**
  * Dialog to edit a upload profile
  */
-class UploadProfileDlg : public KDialog
+class UploadProfileDlg : public QDialog
 {
     Q_OBJECT
 public:
@@ -47,18 +47,18 @@ protected Q_SLOTS:
     /**
      * Implemented to accept() not if the entered url does not exist
      */
-    virtual void slotButtonClicked(int button);
+    virtual void slotAcceptButtonClicked();
 
 private:
     /**
      * Builds the Url from the current entered data
      */
-    KUrl currentUrl();
+    QUrl currentUrl();
 
     /**
      * Sets the values of the widgets to the given url
      */
-    void updateUrl(const KUrl& url);
+    void updateUrl( const QUrl& url );
 
     Ui::UploadProfileDlg* m_ui;
 };
diff --git a/uploadprofileitem.cpp b/uploadprofileitem.cpp
index ee4610e..f957ce4 100644
--- a/uploadprofileitem.cpp
+++ b/uploadprofileitem.cpp
@@ -9,7 +9,6 @@
 ***************************************************************************/
 #include "uploadprofileitem.h"
 
-#include <kurl.h>
 #include <kicon.h>
 #include <kconfiggroup.h>
 
@@ -22,7 +21,7 @@ UploadProfileItem::UploadProfileItem()
     setEditable(false);
 }
 
-void UploadProfileItem::setUrl(const KUrl& url)
+void UploadProfileItem::setUrl(const QUrl& url)
 {
     setData(url, UrlRole);
 }
@@ -51,9 +50,9 @@ void UploadProfileItem::setProfileNr(const QString& nr)
     setData(nr, ProfileNrRole);
 }
 
-KUrl UploadProfileItem::url() const
+QUrl UploadProfileItem::url() const
 {
-    return data(UrlRole).value<KUrl>();
+    return data(UrlRole).value<QUrl>();
 }
 
 bool UploadProfileItem::isDefault() const
diff --git a/uploadprofileitem.h b/uploadprofileitem.h
index b17187a..1d046e3 100644
--- a/uploadprofileitem.h
+++ b/uploadprofileitem.h
@@ -13,7 +13,7 @@
 
 #include <QStandardItem>
 
-class KUrl;
+class QUrl;
 class KConfigGroup;
 
 class UploadProfileItem : public QStandardItem
@@ -27,7 +27,7 @@ public:
     UploadProfileItem();
     virtual ~UploadProfileItem() {}
 
-    void setUrl(const KUrl& url);
+    void setUrl(const QUrl& url);
 
     /**
      * Set if this item is the default upload-profile.
@@ -40,7 +40,7 @@ public:
      */
     void setProfileNr(const QString& nr);
 
-    KUrl url() const;
+    QUrl url() const;
     bool isDefault() const;
 
     /**
diff --git a/uploadprofilemodel.cpp b/uploadprofilemodel.cpp
index 16847b2..bc5153f 100644
--- a/uploadprofilemodel.cpp
+++ b/uploadprofilemodel.cpp
@@ -13,7 +13,6 @@
 #include <KConfigGroup>
 #include <ksettings/dispatcher.h>
 #include <kcomponentdata.h>
-#include <kurl.h>
 
 #include <interfaces/iproject.h>
 
@@ -67,7 +66,7 @@ void UploadProfileModel::revert()
     int row = 0;
     Q_FOREACH (QString g, group.groupList()) {
         if (g.startsWith("Profile")) {
-            KUrl url = KUrl(group.group(g).readEntry("url", QString()));
+            QUrl url = group.group(g).readEntry("url", QUrl());
             QString name = group.group(g).readEntry("name", QString());
             UploadProfileItem* i = uploadItem(row);
             if (!i) {
diff --git a/uploadprojectmodel.cpp b/uploadprojectmodel.cpp
index 30db851..b6d2d9d 100644
--- a/uploadprojectmodel.cpp
+++ b/uploadprojectmodel.cpp
@@ -13,9 +13,10 @@
 #include <kfileitem.h>
 #include <kdatetime.h>
 #include <kdebug.h>
-#include <kurl.h>
+#include <QDir>
 
 #include <interfaces/iproject.h>
+#include <util/path.h>
 
 #include <project/projectmodel.h>
 
@@ -69,13 +70,13 @@ QVariant UploadProjectModel::data(const QModelIndex & indx, int \
role) const  if (m_checkStates.contains(indx)) {
                 return m_checkStates.value(indx);
             } else {
-                kDebug() << "project folder" << m_project->folder() << "file" << i \
                << i->file();
-                kDebug() << "file url" << i->file()->url();
-                QString url = KUrl::relativeUrl(m_project->folder(), \
i->file()->url()); +                kDebug() << "project folder" << \
m_project->path().path() << "file" << i << i->file(); +                kDebug() << \
"file url" << i->file()->path().path(); +                QString url = \
m_project->path().relativePath(i->file()->path());  kDebug() << "resulting url" << \
                url;
                 QDateTime uploadTime(m_profileConfigGroup.readEntry(url, \
QDateTime()));  if (uploadTime.isValid()) {
-                    KFileItem fileItem(KFileItem::Unknown, KFileItem::Unknown, \
i->file()->url()); +                    KFileItem \
                fileItem(i->file()->path().toUrl());
                     QDateTime modTime = fileItem.time(KFileItem::ModificationTime);
                     if (modTime > uploadTime) {
                         return Qt::Checked;
@@ -93,7 +94,7 @@ QVariant UploadProjectModel::data(const QModelIndex & indx, int \
role) const  return m_checkStates.value(indx);
                 } else {
                     //don't check for ModificationTime as we do for files
-                    QString url = KUrl::relativeUrl(m_project->folder(), \
i->folder()->url()); +                    QString url = \
                m_project->path().relativePath(i->folder()->path());
                     QDateTime uploadTime(m_profileConfigGroup.readEntry(url, \
QDateTime()));  if (uploadTime.isValid()) {
                         return Qt::Unchecked;
@@ -225,9 +226,9 @@ QString UploadProjectModel::currentProfileName()
     return m_profileConfigGroup.readEntry("name", QString());
 }
 
-KUrl UploadProjectModel::currentProfileUrl()
+QUrl UploadProjectModel::currentProfileUrl()
 {
-    return KUrl(m_profileConfigGroup.readEntry("url", QString()));
+    return m_profileConfigGroup.readEntry("url", QUrl());
 }
 
 void UploadProjectModel::checkAll()
diff --git a/uploadprojectmodel.h b/uploadprojectmodel.h
index 8379810..1dbf683 100644
--- a/uploadprojectmodel.h
+++ b/uploadprojectmodel.h
@@ -21,7 +21,7 @@ namespace KDevelop {
     class ProjectModel;
     class ProjectBaseItem;
 }
-class KUrl;
+class QUrl;
 
 /**
  * ProxyModel that adds checkboxes for upload status to the ProjectModel.
@@ -81,9 +81,9 @@ public:
     /**
      * Returns the url of the current Upload Profile (which is set through \
                setProfileConfigGroup)
      */
-    KUrl currentProfileUrl();
+    QUrl currentProfileUrl();
 
-public Q_SLOTS:    
+public Q_SLOTS:
     /**
      * Checks all items
      */


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

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