Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How can i get ftp files show on my list widget using QNetworkAccessManager Qt 5.8?
QtWS25 Last Chance

How can i get ftp files show on my list widget using QNetworkAccessManager Qt 5.8?

Scheduled Pinned Locked Moved Solved General and Desktop
41 Posts 7 Posters 13.9k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    walter-j
    wrote on 9 Feb 2017, 18:04 last edited by
    #1

    Dear Freinds,

    Im writing a small ftp program that can connect to ftp.trolltech.com and list all files on a list widgets and download it. i can connect to ftp.trolltech.com but i don't know how to list them . Please help me im new in Qt programming.

    Thank you for your support.

    Josephat Kabitshwa

    1 Reply Last reply
    0
    • W Offline
      W Offline
      walter-j
      wrote on 9 Feb 2017, 18:10 last edited by
      #2

      FtpDialog.h

      #ifndef FTPDIALOG_H
      #define FTPDIALOG_H

      #include <QDialog>
      #include <QNetworkAccessManager>
      #include <QNetworkReply>
      #include <QNetworkRequest>
      #include <QUrl>
      #include <QDebug>

      namespace Ui {
      class FtpDialog;
      }

      class FtpDialog : public QDialog
      {
      Q_OBJECT

      public:
      explicit FtpDialog(QWidget *parent = 0);
      ~FtpDialog();

      public slots:
      void connectClicked();
      void readRead(QNetworkReply *reply);
      void getFiles(QNetworkReply *reply);
      signals:
      void dataReadyRead(QByteArray);

      private:
      Ui::FtpDialog *ui;
      QNetworkAccessManager *ftp = new QNetworkAccessManager(this);
      };

      #endif // FTPDIALOG_H

      Josephat Kabitshwa

      1 Reply Last reply
      0
      • W Offline
        W Offline
        walter-j
        wrote on 9 Feb 2017, 18:17 last edited by
        #3

        FtpDialog.cpp

        #include "ftpdialog.h"
        #include "ui_ftpdialog.h"

        FtpDialog::FtpDialog(QWidget *parent) :
        QDialog(parent),
        ui(new Ui::FtpDialog)
        {
        ui->setupUi(this);
        connect(ui->connectButton, SIGNAL(clicked()), this, SLOT(connectClicked()));
        connect(ftp, SIGNAL(finished(QNetworkReply )), this, SLOT(readRead(QNetworkReply )));
        connect(ftp, SIGNAL(finished(QNetworkReply
        )), this, SLOT(getFiles(QNetworkReply
        )));

        ui->disconnectButton->setEnabled(false);
        ui->cdButton->setEnabled(false);
        ui->upButton->setEnabled(false);
        ui->getButton->setEnabled(false);
        

        }

        FtpDialog::~FtpDialog()
        {
        delete ui;
        }

        void FtpDialog::connectClicked()
        {
        ui->connectButton->setEnabled(false);

         ftp->get(QNetworkRequest(QUrl("ftp.trolltech.com")));
         ui->statusLabel->setText(tr("Connecting to host..."));
        

        }

        void FtpDialog::readRead(QNetworkReply *reply)
        {
        ui->statusLabel->setText(tr("Ready."));

        ui->disconnectButton->setEnabled(true);
        ui->cdButton->setEnabled(true);
        ui->upButton->setEnabled(true);
        ui->getButton->setEnabled(true);
        

        }

        void FtpDialog::getFiles(QNetworkReply *reply)
        {

        QByteArray data = reply->readAll();
        qDebug()<< data;
        

        }

        Josephat Kabitshwa

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 9 Feb 2017, 21:58 last edited by
          #4

          Hi,

          The old QFtp module might make your life easier.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          1
          • W Offline
            W Offline
            walter-j
            wrote on 9 Feb 2017, 22:11 last edited by
            #5

            But Qt Creator does not recognize it. what can i do please?

            Josephat Kabitshwa

            1 Reply Last reply
            0
            • S Offline
              S Offline
              SGaist
              Lifetime Qt Champion
              wrote on 9 Feb 2017, 22:13 last edited by
              #6

              Clone it and build it.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              1
              • W Offline
                W Offline
                walter-j
                wrote on 9 Feb 2017, 22:16 last edited by
                #7

                those links gave me a 404 error. sorry

                Josephat Kabitshwa

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on 9 Feb 2017, 22:17 last edited by
                  #8

                  What links ?

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0
                  • W Offline
                    W Offline
                    walter-j
                    wrote on 9 Feb 2017, 22:23 last edited by
                    #9

                    git://code.qt.io/qt/qtftp.git
                    http://code.qt.io/qt/qtftp.git
                    https://code.qt.io/qt/qtftp.git

                    Josephat Kabitshwa

                    1 Reply Last reply
                    0
                    • S Offline
                      S Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on 9 Feb 2017, 22:28 last edited by
                      #10

                      Those are links to use with the git clone command.

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      1
                      • W Offline
                        W Offline
                        walter-j
                        wrote on 9 Feb 2017, 22:32 last edited by
                        #11

                        please be patient with me im new in Qt. i have typed git clone git://code.qt.io/qt/qtftp.git. i have this message checking connectivity....done. what can i do else?

                        Josephat Kabitshwa

                        1 Reply Last reply
                        0
                        • S Offline
                          S Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote on 9 Feb 2017, 22:37 last edited by
                          #12

                          This has nothing to do with Qt.

                          Didn't you get a new folder named qtftp ?

                          Interested in AI ? www.idiap.ch
                          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                          1 Reply Last reply
                          0
                          • W Offline
                            W Offline
                            walter-j
                            wrote on 9 Feb 2017, 22:38 last edited by
                            #13

                            yes . will i build it in Qt?

                            Josephat Kabitshwa

                            1 Reply Last reply
                            0
                            • S Offline
                              S Offline
                              SGaist
                              Lifetime Qt Champion
                              wrote on 9 Feb 2017, 22:45 last edited by
                              #14

                              Open the project .pro file with Qt Creator and build it.

                              By the way, what OS are you on ?

                              Interested in AI ? www.idiap.ch
                              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                              1 Reply Last reply
                              0
                              • W Offline
                                W Offline
                                walter-j
                                wrote on 9 Feb 2017, 22:48 last edited by
                                #15

                                linux mint 18 sarah

                                Josephat Kabitshwa

                                1 Reply Last reply
                                0
                                • W Offline
                                  W Offline
                                  walter-j
                                  wrote on 9 Feb 2017, 22:53 last edited by
                                  #16

                                  i got this message : cannot create a directory / mkspecs/modules-inst when im building it

                                  Josephat Kabitshwa

                                  1 Reply Last reply
                                  0
                                  • S Offline
                                    S Offline
                                    SGaist
                                    Lifetime Qt Champion
                                    wrote on 9 Feb 2017, 22:55 last edited by
                                    #17

                                    Which version of Qt are you using to build that module ?

                                    Interested in AI ? www.idiap.ch
                                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                    1 Reply Last reply
                                    0
                                    • W Offline
                                      W Offline
                                      walter-j
                                      wrote on 9 Feb 2017, 22:59 last edited by
                                      #18

                                      Qt 5.7.1 . now i can build . what can i do else?

                                      Josephat Kabitshwa

                                      1 Reply Last reply
                                      0
                                      • W Offline
                                        W Offline
                                        walter-j
                                        wrote on 9 Feb 2017, 23:04 last edited by
                                        #19

                                        my programm does not recognize QFtp but i have already built it

                                        Josephat Kabitshwa

                                        1 Reply Last reply
                                        0
                                        • S Offline
                                          S Offline
                                          SGaist
                                          Lifetime Qt Champion
                                          wrote on 9 Feb 2017, 23:18 last edited by
                                          #20

                                          Did you install the module ?

                                          Interested in AI ? www.idiap.ch
                                          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                          V 1 Reply Last reply 24 Feb 2017, 03:09
                                          0

                                          2/41

                                          9 Feb 2017, 18:10

                                          39 unread
                                          • Login

                                          • Login or register to search.
                                          2 out of 41
                                          • First post
                                            2/41
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • Users
                                          • Groups
                                          • Search
                                          • Get Qt Extensions
                                          • Unsolved