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:
Code:
...
#include <QNetworkAccessManager>
...
if (0 == QNetworkAccessManager::NotAccessible) {
QString completeMessage
= i18n
("Sorry, you have no internet connection at the moment \n" "Will stop bundle(s) installation now");
KDialog *dialog = new KDialog(this, Qt::FramelessWindowHint);
dialog->setButtons(KDialog::Ok);
dialog->setModal(true);
bool retbool;
KMessageBox
::createKMessageBox(dialog,
QMessageBox::Warning, completeMessage,
return;
}
Has anybody an idea?
Re: QNetworkAccessManager internet status usage ?!?
What exactly is the problem?
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:
Code:
# check if we have a internet connection
ping_check=$(LC_ALL=C ping -c 1 www.google.com | grep "1 received")
...
if [ "${ping_check}" != "" ] ; then
pkg_installed=`pacman -Q --noconfirm | grep ${KDE_L10N_PREFIX}-${kdelang}`
pkg_check=`pacman -Ss ${KDE_L10N_PREFIX}-${kdelang} --noconfirm | grep ${KDE_L10N_PREFIX}-${kdelang}`
if [ "${pkg_check}" = "" ] || [ "${pkg_installed}" != "" ]; then
msg "no ${KDE_L10N_PREFIX}-${kdelang} available or already installed. skipping"
else
msg "installing ${KDE_L10N_PREFIX}-${kdelang}"
chroot ${mountpoint} /usr/bin/pacman -Syf ${KDE_L10N_PREFIX}-${kdelang} --noconfirm
fi
else
msg "no internet connection available. skipping"
fi
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?