Results 1 to 9 of 9

Thread: QFtp->get() traversing trewidget

  1. #1
    Join Date
    May 2007
    Location
    Germany
    Posts
    89
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default QFtp->get() traversing trewidget

    Hello friends,

    I make a connection to a ftp server and there was 6 folder.

    .
    ..
    A
    B
    C
    D
    E
    F

    Then I use the command mdFtp->cd("E"); to go in one folder to see the files or whatever?
    When I click on one item I can download them with the command:
    Qt Code:
    1. mdFtp->get(mdTreewidget->currentItem()->text(0), mdfile);
    To copy to clipboard, switch view to plain text mode 

    How can I get all files in one specific folder at one Time??
    I try it with this loop but no result:

    Qt Code:
    1. for (int i=0; i< mdTreewidget->currentItem()->childCount(); i++)
    To copy to clipboard, switch view to plain text mode 

    Have anybody an idea???

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QFtp->get() traversing trewidget

    That loop alone doesn't tell much how do you actually handle it. Every call to QFtp::get() schedules a command and returns associated unique identifier. Did you take this into account?
    J-P Nurmi

  3. #3
    Join Date
    May 2007
    Location
    Germany
    Posts
    89
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QFtp->get() traversing trewidget

    Hello,

    actualy I make this:
    Qt Code:
    1. void MdFtpWindow::downThemAll() /button click Download
    2. {
    3. mdFtp->get(mdTreewidget->currentItem()->text(0), mdfile);
    4.  
    5. }
    To copy to clipboard, switch view to plain text mode 

    That means one download click per file and after I try this:

    Qt Code:
    1. void MdFtpWindow::downThemAll() /button click Download
    2. {
    3.  
    4.  
    5. for (int i=0; i< mdTreewidget->currentItem()->childCount(); i++)
    6. {
    7.  
    8. mdFtp->get(mdTreewidget->itemAt(0,i)->text(0), mdfile);
    9.  
    10. }
    11.  
    12. }
    To copy to clipboard, switch view to plain text mode 

    And it seems that I must always click the Download Button per File. It don´t loop or parse the files in the Folder and get them!!

    any Idea???

  4. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QFtp->get() traversing trewidget

    Don't you think you should pass a different output file?
    J-P Nurmi

  5. #5
    Join Date
    May 2007
    Location
    Germany
    Posts
    89
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QFtp->get() traversing trewidget

    What do you mean????

  6. #6
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QFtp->get() traversing trewidget

    You are passing the same target device ("mdfile") to every get() request.
    J-P Nurmi

  7. #7
    Join Date
    May 2007
    Location
    Germany
    Posts
    89
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QFtp->get() traversing trewidget

    Ok I think I have trouble with the index.

    When I use mdftp->cd("myfolder");

    How can I acces the files under myfolder???

    How do I iterate them??

  8. #8
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QFtp->get() traversing trewidget

    See QFtp::list(). You might also want to take a look at the FTP example shipped with Qt.
    J-P Nurmi

  9. #9
    Join Date
    May 2007
    Location
    Germany
    Posts
    89
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QFtp->get() traversing trewidget

    Hello,

    I think I got it:

    Qt Code:
    1. QTreeWidgetItemIterator it(mdTreewidget);
    2. while (*it) {
    3. QMessageBox::information(this, tr("DebugMessage"),
    4. tr("ItemText: %1 ")
    5. .arg((*it)->text(0)));
    6. ++it;
    7. }
    To copy to clipboard, switch view to plain text mode 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.