Results 1 to 4 of 4

Thread: QNetworkAccessManager internet status usage ?!?

  1. #1
    Join Date
    Jan 2011
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Question QNetworkAccessManager internet status usage ?!?

    Hi there. Maybe this was already asked but since we added this commit to our source my problem starte:

    http://gitorious.org/chakra/tribe/co...703bc04c0ab56b

    It seems we disabled installation of bundles and pkgs completely. Even in konversation this check is not used for over one year:

    http://gitorious.com/konversation/ko...commit/9ad4111

    Now I found some in qt rev:

    http://doc.qt.nokia.com/4.7-snapshot...ssibility-enum

    ... still don't get it right:

    Qt Code:
    1. ...
    2. #include <QNetworkAccessManager>
    3. ...
    4. if (0 == QNetworkAccessManager::NotAccessible) {
    5. QString completeMessage = i18n("Sorry, you have no internet connection at the moment \n"
    6. "Will stop bundle(s) installation now");
    7.  
    8. KDialog *dialog = new KDialog(this, Qt::FramelessWindowHint);
    9. dialog->setButtons(KDialog::Ok);
    10. dialog->setModal(true);
    11. bool retbool;
    12.  
    13. KMessageBox::createKMessageBox(dialog, QMessageBox::Warning, completeMessage,
    14. QStringList(), QString(), &retbool, KMessageBox::Notify);
    15. return;
    16. }
    To copy to clipboard, switch view to plain text mode 
    Has anybody an idea?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,364
    Thanks
    3
    Thanked 5,014 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QNetworkAccessManager internet status usage ?!?

    What exactly is the problem?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Jan 2011
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QNetworkAccessManager internet status usage ?!?

    Well, I don't get the status at all. What I want to achieve:

    User clicks on button to install a package in linux after he selected it from a list.
    If you don't have internet connection a message should be shown telling him: No internet connection - No Package installation"
    Progress should terminate then else it should start the package installation routine.

    Problem is now: How to get a proper internet status with a value I can use to decide what to do if internet connection is there or not.

    In bash I would ping google and use the result:

    Qt Code:
    1. # check if we have a internet connection
    2. ping_check=$(LC_ALL=C ping -c 1 www.google.com | grep "1 received")
    3.  
    4. ...
    5.  
    6. if [ "${ping_check}" != "" ] ; then
    7. pkg_installed=`pacman -Q --noconfirm | grep ${KDE_L10N_PREFIX}-${kdelang}`
    8. pkg_check=`pacman -Ss ${KDE_L10N_PREFIX}-${kdelang} --noconfirm | grep ${KDE_L10N_PREFIX}-${kdelang}`
    9. if [ "${pkg_check}" = "" ] || [ "${pkg_installed}" != "" ]; then
    10. msg "no ${KDE_L10N_PREFIX}-${kdelang} available or already installed. skipping"
    11. else
    12. msg "installing ${KDE_L10N_PREFIX}-${kdelang}"
    13. chroot ${mountpoint} /usr/bin/pacman -Syf ${KDE_L10N_PREFIX}-${kdelang} --noconfirm
    14. fi
    15. else
    16. msg "no internet connection available. skipping"
    17. fi
    To copy to clipboard, switch view to plain text mode 

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,364
    Thanks
    3
    Thanked 5,014 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QNetworkAccessManager internet status usage ?!?

    See the docs for Bearer Management.

    By the way, pinging Google is a bit amateur and unreliable approach - your ISP might be blocking ping calls and then what?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Internet Radio (Qt)
    By somnathbanik in forum Newbie
    Replies: 0
    Last Post: 18th November 2010, 14:08
  2. Replies: 3
    Last Post: 8th July 2010, 07:41
  3. Internet Speedometer
    By dilidpan in forum Qt Programming
    Replies: 10
    Last Post: 23rd May 2010, 15:50
  4. How to use a image from internet
    By kellen851105 in forum Qt Programming
    Replies: 1
    Last Post: 4th March 2010, 06:16
  5. Is internet connected
    By bunjee in forum Qt Programming
    Replies: 2
    Last Post: 24th November 2009, 21:22

Tags for this Thread

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.