Advertisement
Guest User

Untitled

a guest
May 29th, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.50 KB | None | 0 0
  1. FtpManager::FtpManager(QWidget *parent) :
  2.     QWidget(parent),
  3.     ui(new Ui::FtpManager)
  4. {
  5.     ui->setupUi(this);
  6.     connect(ui->connectButton,SIGNAL(clicked()),this,SLOT(connectClicked()));
  7.     connect(&ftp,SIGNAL(commandFinished(int,bool)),this,SLOT(commandFinishedSlot(int,bool)));
  8.     connect(&ftp,SIGNAL(listInfo(QUrlInfo)),this,SLOT(listInfoSlot(QUrlInfo)));
  9.  
  10.     connect(ui->disconnectButton,SIGNAL(clicked()),this,SLOT(disconnectClicked()));
  11.  
  12.     connect(ui->remoteList,SIGNAL(itemDoubleClicked(QListWidgetItem*)),this,SLOT(remoteListDoubleClicked(QListWidgetItem*)));
  13.     connect(ui->remoteList,SIGNAL(itemSelectionChanged()),this,SLOT(remoteListSelectionChanged()));
  14.     /*
  15.     connect(ui->downloadButton,SIGNAL(clicked()),this,SLOT(downloadClicked()));
  16.     connect(ui->uploadButton,SIGNAL(clicked()), this, SLOT(uploadClicked()));
  17.     connect(ui->openDirectoryButton,SIGNAL(clicked()),this,SLOT(openClicked()));
  18.  
  19.     connect(ui->localList,SIGNAL(itemSelectionChanged()),this,SLOT(localChanged()));
  20.  
  21. */
  22.     listLocalFiles();
  23.     ui->disconnectButton->setEnabled(false);
  24.     ui->uploadButton->setEnabled(false);
  25.     ui->downloadButton->setEnabled(false);
  26.  
  27. }
  28. void FtpManager::listLocalFiles(const QString &currentdir = "") {
  29.     QDir dir(currentdir);
  30.     dir.setFilter(QDir::Files | QDir::Hidden | QDir::Dirs);
  31.     QFileInfoList list = dir.entryInfoList();
  32.     for (int i=0; i<list.size(); i++) {
  33.         QFileInfo info = list.at(i);
  34.         ui->localList->addItem(info.fileName());
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement