Commit 0db733fe authored by Philip Müller's avatar Philip Müller

[rebuild] revert some commits regarding net check

parent a7452639
......@@ -13,7 +13,7 @@ pkgbase=octopi
pkgname=('octopi' 'octopi-repoeditor' 'octopi-pacmanhelper' 'octopi-cachecleaner'
'octopi-notifier-qt5' 'octopi-notifier-frameworks')
pkgver=0.9.0
pkgrel=1
pkgrel=2
# This is the release package so the below _gitcommit variable should (usually) be commented out.
#_gitcommit=
arch=('i686' 'x86_64')
......@@ -26,7 +26,13 @@ if [ "${_gitcommit}" != "" ]; then
else
source=("octopi-${pkgver}.tar.gz::https://github.com/aarnt/octopi/archive/v${pkgver}.tar.gz")
fi
sha256sums=('f6c7fe6bbcc26a79b1e455a42a8dc906bee4edd1b386b4f76178f006f4d7f822')
source+=('revert-c413caa.patch'
'revert-a9d9eb3.patch'
'revert-e861352.patch')
sha256sums=('f6c7fe6bbcc26a79b1e455a42a8dc906bee4edd1b386b4f76178f006f4d7f822'
'9f488022cfa15219d39458d8916cb1b413ef0d977f90cc283d8e63e4284cd301'
'0531aa7afe0eccc1c8c80eb5729b5998ee0b9f453037b15c496f5503684214fe'
'26cf422b63b89b71eb093fe16efded95db79c133eefafddbb61424fe95b0586f')
prepare() {
......@@ -42,6 +48,11 @@ prepare() {
cp -r notifier notifier-qt5
cp -r notifier notifier-frameworks
sed -i 's|#KSTATUS|KSTATUS|' notifier-frameworks/octopi-notifier/octopi-notifier.pro
# fix network detection
patch -Rp1 -i $srcdir/revert-c413caa.patch
patch -Rp1 -i $srcdir/revert-a9d9eb3.patch
patch -Rp1 -i $srcdir/revert-e861352.patch
}
build() {
......@@ -199,4 +210,4 @@ package_octopi-notifier-frameworks() {
# Octopi-notifier-frameworks files
install -Dm755 "notifier-frameworks/bin/octopi-notifier" "${pkgdir}/usr/bin/octopi-notifier"
install -Dm644 "notifier-frameworks/octopi-notifier/octopi-notifier.desktop" "${pkgdir}/etc/xdg/autostart/octopi-notifier.desktop"
}
\ No newline at end of file
}
From a9d9eb30d37e97369cfc64204fe0bde9e0e29918 Mon Sep 17 00:00:00 2001
From: Alexandre Arnt <falso@correio.com>
Date: Sun, 6 May 2018 18:23:46 -0300
Subject: [PATCH] - BugFix: Exec internet tests before some commands in Octopi
and Notifier.
---
CHANGELOG | 2 +-
notifier/octopi-notifier/mainwindow.cpp | 32 +++++++++++++++++++++++++++++++-
notifier/octopi-notifier/mainwindow.h | 1 +
3 files changed, 33 insertions(+), 2 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index 49f1936..bb9044a 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -21,7 +21,7 @@
Find line edit is always focused when the program starts.
Prevent user to install partial upgrades in his system (only some of the outdated packages).
BugFix: Do not let program display an avalanche of internet related errors.
- BugFix: Exec internet tests before some commands.
+ BugFix: Exec internet tests before some commands in Octopi and Notifier.
BugFix: Parser was not outputing repository errors when syncinc.
BugFix: repoeditor now runs as normal user and asks for root password on save.
BugFix: If Notifier hid Octopi and was closed, Octopi's window would stay hidden.
diff --git a/notifier/octopi-notifier/mainwindow.cpp b/notifier/octopi-notifier/mainwindow.cpp
index 3dadbb0..3b92b91 100644
--- a/notifier/octopi-notifier/mainwindow.cpp
+++ b/notifier/octopi-notifier/mainwindow.cpp
@@ -179,7 +179,7 @@ void MainWindow::pacmanHelperTimerTimeout()
{
static bool firstTime=true;
- if (!UnixCommand::hasInternetConnection() || m_commandExecuting != ectn_NONE) return;
+ if (/*!UnixCommand::hasInternetConnection() ||*/ m_commandExecuting != ectn_NONE) return;
if (firstTime)
{
@@ -337,6 +337,8 @@ bool MainWindow::_isSUAvailable()
*/
void MainWindow::doSystemUpgrade()
{
+ if (!isInternetAvailable()) return;
+
//If, for whatever reason, the pacman db is locked, let's ask for lock removal
if (PacmanExec::isDatabaseLocked())
{
@@ -616,11 +618,39 @@ void MainWindow::afterPacmanHelperSyncDatabase()
}
}
+/*
+ * Checks if Internet connection is up/down
+ */
+bool MainWindow::isInternetAvailable()
+{
+ bool res=true;
+
+ //First we create a fake window to act as about dialog's parent
+ //Otherwise the dialog appears at a random screen point!
+ QMainWindow *fake = new QMainWindow();
+ fake->setWindowIcon(m_icon);
+ fake->setVisible(false);
+ QScreen *sc = QGuiApplication::primaryScreen();
+ fake->setGeometry(sc->geometry());
+
+ //Test if Internet access exists
+ if (!UnixCommand::hasInternetConnection())
+ {
+ QMessageBox::critical(fake, StrConstants::getError(), StrConstants::getInternetUnavailableError());
+ res=false;
+ delete fake;
+ }
+
+ return res;
+}
+
/*
* Called every time user selects "Sync databases..." menu option
*/
void MainWindow::syncDatabase()
{
+ if (!isInternetAvailable()) return;
+
//If, for whatever reason, the pacman db is locked, let's ask for lock removal
if (PacmanExec::isDatabaseLocked())
{
diff --git a/notifier/octopi-notifier/mainwindow.h b/notifier/octopi-notifier/mainwindow.h
index 738c22f..4e28479 100644
--- a/notifier/octopi-notifier/mainwindow.h
+++ b/notifier/octopi-notifier/mainwindow.h
@@ -114,6 +114,7 @@ private slots:
PacmanHelperClient *m_pacmanHelperClient;
bool _isSUAvailable();
+ bool isInternetAvailable();
void initActions();
void initSystemTrayIcon();
void sendNotification(const QString &msg);
From c413caadd11883ffcebf13ce515fb17bc23ebd27 Mon Sep 17 00:00:00 2001
From: Alexandre Arnt <falso@correio.com>
Date: Sun, 6 May 2018 19:55:25 -0300
Subject: [PATCH] - BugFix: sysinfo tests for internet connection.
---
src/mainwindow.cpp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 602f3b8..8fb816a 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -1698,6 +1698,8 @@ void MainWindow::ptpbSysInfo()
if (!UnixCommand::hasTheExecutable("curl") ||
m_commandExecuting != ectn_NONE) return;
+ if (!isInternetAvailable()) return;
+
disableTransactionActions();
m_commandExecuting = ectn_SYSINFO;
clearTabOutput();
From e8613527b65fda27213e65e1b0f345480a085445 Mon Sep 17 00:00:00 2001
From: Alexandre Arnt <falso@correio.com>
Date: Sat, 21 Apr 2018 19:08:41 -0300
Subject: [PATCH] BugFix: Exec internet tests before some commands.
---
CHANGELOG | 1 +
src/mainwindow.h | 1 +
src/mainwindow_events.cpp | 2 ++
src/mainwindow_news.cpp | 7 +++++++
src/mainwindow_transaction.cpp | 23 +++++++++++++++++++++++
src/unixcommand.cpp | 4 ++--
6 files changed, 36 insertions(+), 2 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index f178491..5a7fbbe 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -21,6 +21,7 @@
Find line edit is always focused when the program starts.
Prevent user to install partial upgrades in his system (only some of the outdated packages).
BugFix: Do not let program display an avalanche of internet related errors.
+ BugFix: Exec internet tests before some commands.
BugFix: Parser was not outputing repository errors when syncinc.
BugFix: repoeditor now runs as normal user and asks for root password on save.
BugFix: If Notifier hid Octopi and was closed, Octopi's window would stay hidden.
diff --git a/src/mainwindow.h b/src/mainwindow.h
index c6ae4c5..66a5223 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -303,6 +303,7 @@ public slots:
void ensureTabVisible(const int index);
bool isPropertiesTabWidgetVisible();
bool isSUAvailable();
+ bool isInternetAvailable();
void writeToTabOutput(const QString &msg, TreatURLLinks treatURLLinks = ectn_TREAT_URL_LINK);
void initTabOutput();
diff --git a/src/mainwindow_events.cpp b/src/mainwindow_events.cpp
index 54fb070..ebcb099 100644
--- a/src/mainwindow_events.cpp
+++ b/src/mainwindow_events.cpp
@@ -121,6 +121,8 @@ void MainWindow::keyPressEvent(QKeyEvent
{
if (UnixCommand::getLinuxDistro() == ectn_KAOS && ui->actionUseInstantSearch->isChecked()) return;
+ if (!isInternetAvailable()) return;
+
m_progressWidget->setMaximum(100);
m_progressWidget->setValue(0);
m_progressWidget->show();
diff --git a/src/mainwindow_news.cpp b/src/mainwindow_news.cpp
index 1deaef1..5749db4 100644
--- a/src/mainwindow_news.cpp
+++ b/src/mainwindow_news.cpp
@@ -49,6 +49,13 @@ void MainWindow::refreshDistroNews(bool searchForLatestNews, bool gotoNewsTab)
if (searchForLatestNews)
{
+ if (!isInternetAvailable())
+ {
+ ui->actionGetNews->setEnabled(true);
+ ui->twProperties->setCurrentIndex(ctn_TABINDEX_NEWS);
+ return;
+ }
+
LinuxDistro distro = UnixCommand::getLinuxDistro();
if (gotoNewsTab)
diff --git a/src/mainwindow_transaction.cpp b/src/mainwindow_transaction.cpp
index b46f663..7813d0c 100644
--- a/src/mainwindow_transaction.cpp
+++ b/src/mainwindow_transaction.cpp
@@ -671,6 +671,23 @@ void MainWindow::onPressDelete()
}
}
+/*
+ * Checks if Internet connection is up/down
+ */
+bool MainWindow::isInternetAvailable()
+{
+ bool res=true;
+
+ //Test if Internet access exists
+ if (!UnixCommand::hasInternetConnection())
+ {
+ QMessageBox::critical(this, StrConstants::getError(), StrConstants::getInternetUnavailableError());
+ res=false;
+ }
+
+ return res;
+}
+
/*
* Checks if some SU utility is available...
* Returns false if not!
@@ -727,6 +744,8 @@ void MainWindow::doSyncDatabase()
//if (!doRemovePacmanLockFile()) return;
if (!isSUAvailable()) return;
+ if (!isInternetAvailable()) return;
+
//Let's synchronize kcp database too...
if (UnixCommand::getLinuxDistro() == ectn_KAOS && UnixCommand::hasTheExecutable(ctn_KCP_TOOL) && !UnixCommand::isRootRunning())
UnixCommand::execCommandAsNormalUser("kcp -u");
@@ -843,6 +862,8 @@ void MainWindow::doSystemUpgrade(SystemUpgradeOptions systemUpgradeOptions)
if (!isSUAvailable()) return;
+ if(!isInternetAvailable()) return;
+
qApp->processEvents();
int res;
@@ -1683,6 +1704,8 @@ void MainWindow::toggleSystemActions(const bool value)
*/
void MainWindow::commitTransaction()
{
+ if (!isInternetAvailable()) return;
+
//Are there any remove actions to be commited?
if(getRemoveTransactionParentItem()->rowCount() > 0 && getInstallTransactionParentItem()->rowCount() > 0)
{
diff --git a/src/unixcommand.cpp b/src/unixcommand.cpp
index 013564a..f48483b 100644
--- a/src/unixcommand.cpp
+++ b/src/unixcommand.cpp
@@ -595,10 +595,10 @@ bool UnixCommand::hasInternetConnection()
}
//It seems to be alright, but let's make a ping to see the result
- /*if (result == true)
+ if (result == true)
{
result = UnixCommand::doInternetPingTest();
- }*/
+ }
return result;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment