Compare commits
3 Commits
ubuntu/ora
...
tsimonq2/n
Author | SHA1 | Date |
---|---|---|
Simon Quigley | 45e3835a55 | 11 months ago |
Simon Quigley | cae134166b | 11 months ago |
Simon Quigley | 8cebb36a9c | 11 months ago |
@ -1,2 +0,0 @@
|
||||
CMakeLists.txt.user
|
||||
build
|
@ -1 +1 @@
|
||||
lubuntu-update-notifier_1.1.0~ppa1_source.buildinfo admin optional
|
||||
lubuntu-update-notifier_1.0.0~alpha1_source.buildinfo admin optional
|
||||
|
@ -1,11 +0,0 @@
|
||||
#!/bin/bash
|
||||
langList=('en_US' 'es_ES' 'zh_CN')
|
||||
for i in ${langList[@]}; do
|
||||
targetFile="translations/lubuntu-update_$i.ts"
|
||||
if [ ! -e $targetFile ]; then
|
||||
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>" > $targetFile
|
||||
echo "<!DOCTYPE TS>" >> $targetFile
|
||||
echo "<TS version=\"2.1\" language=\"$i\"></TS>" >> $targetFile
|
||||
fi
|
||||
done
|
||||
lupdate *.cpp *.h *.ui -ts translations/*
|
@ -0,0 +1,38 @@
|
||||
#include "ipcfilewatcher.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QFileSystemWatcher>
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
IPCFileWatcher::IPCFileWatcher(QObject *parent)
|
||||
: QObject{parent}
|
||||
{
|
||||
QDir targetDir("/dev/shm/lubuntu-update");
|
||||
bool couldRemove = targetDir.removeRecursively();
|
||||
if (!couldRemove) {
|
||||
qCritical() << "Could not clear IPC directory. Ensure that /dev/shm and /dev/shm/lubuntu-update are world-readable and world-writable.";
|
||||
initFailed = true;
|
||||
return;
|
||||
}
|
||||
targetDir.mkdir("/dev/shm/lubuntu-update");
|
||||
QFileSystemWatcher *watcher = new QFileSystemWatcher(QStringList() << "/dev/shm/lubuntu-update");
|
||||
connect(watcher, &QFileSystemWatcher::directoryChanged, this, &IPCFileWatcher::checkForShowWindowFile);
|
||||
initFailed = false;
|
||||
}
|
||||
|
||||
bool IPCFileWatcher::didInitFail()
|
||||
{
|
||||
return initFailed;
|
||||
}
|
||||
|
||||
void IPCFileWatcher::checkForShowWindowFile()
|
||||
{
|
||||
QFile flagFile("/dev/shm/lubuntu-update/lubuntu-update-show-win");
|
||||
if (flagFile.exists()) {
|
||||
flagFile.remove();
|
||||
emit showWindowFlagDetected();
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
#ifndef IPCFILEWATCHER_H
|
||||
#define IPCFILEWATCHER_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
class IPCFileWatcher : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit IPCFileWatcher(QObject *parent = nullptr);
|
||||
bool didInitFail();
|
||||
|
||||
signals:
|
||||
void showWindowFlagDetected();
|
||||
|
||||
private:
|
||||
bool initFailed;
|
||||
|
||||
void checkForShowWindowFile();
|
||||
};
|
||||
|
||||
#endif // IPCFILEWATCHER_H
|
@ -0,0 +1,92 @@
|
||||
#!/bin/bash
|
||||
# Backend script for Lubuntu Update (does text processing and update installation, can be run as root and must be in order to install updates)
|
||||
|
||||
set -e
|
||||
export LC_ALL='C'
|
||||
|
||||
if [ "$1" = 'pkgver' ]; then
|
||||
shift
|
||||
while [ "$1" != '' ]; do
|
||||
source="$(apt-cache show "$1" | grep 'Source:' | cut -d' ' -f2)"
|
||||
version="$(apt-cache show lubuntu-default-settings | grep Version: | head -n1 | cut -d' ' -f2)"
|
||||
if [ "$source" = '' ]; then
|
||||
echo "$1"
|
||||
else
|
||||
echo "$source"
|
||||
fi
|
||||
echo "$version"
|
||||
shift
|
||||
done
|
||||
elif [ "$1" = 'doupdate' ]; then
|
||||
# Prepare to be able to grep through the logs
|
||||
rm /run/lubuntu-update-apt-log || true
|
||||
touch /run/lubuntu-update-apt-log
|
||||
chmod 0600 /run/lubuntu-update-apt-log # prevent non-root from being able to trick the script into deleting arbitrary files later on
|
||||
|
||||
# Repair an interrupted upgrade if necessary
|
||||
dpkg --configure -a
|
||||
|
||||
# Run the real update
|
||||
DEBIAN_FRONTEND='kde' apt-get -o Dpkg::Options::='--force-confdef' -o Dpkg::Options::='--force-confold' -o Apt::Color='0' -o Dpkg::Use-Pty='0' -y dist-upgrade |& tee /run/lubuntu-update-apt-log
|
||||
|
||||
# Find all the conffiles
|
||||
mapfile conffileRawList <<< "$(grep -P "^Configuration file \'.*\'$" '/run/lubuntu-update-apt-log')"
|
||||
if [ "$(echo "${conffileRawList[0]}" | head -c1)" != 'C' ]; then # Empty or invalid list, we're done
|
||||
exit 0
|
||||
fi
|
||||
|
||||
conffileList=()
|
||||
counter=0
|
||||
while [ "$counter" -lt "${#conffileRawList[@]}" ]; do
|
||||
# Cut off "Configuration file '" from the start and "'" plus a couple trailing characters from the end
|
||||
conffileList[counter]="$(echo "${conffileRawList[$counter]}" | tail -c+21 | head -c-3)"
|
||||
counter=$((counter+1))
|
||||
done
|
||||
|
||||
echo "Lubuntu Update !!! CONFIGURATION FILE LIST START";
|
||||
counter=0
|
||||
while [ "$counter" -lt "${#conffileList[@]}" ]; do
|
||||
echo "${conffileList[$counter]}"
|
||||
counter=$((counter+1))
|
||||
done
|
||||
echo "Lubuntu Update !!! CONFIGURATION FILE LIST END";
|
||||
|
||||
# If we make it this far, there were conffiles to deal with
|
||||
breakLoop='no'
|
||||
gotCommand='no'
|
||||
commandName=''
|
||||
while [ "$breakLoop" = 'no' ]; do
|
||||
read -r inputVal
|
||||
if [ "$gotCommand" = 'no' ]; then
|
||||
if [ "$inputVal" = 'done' ]; then
|
||||
breakLoop='yes'
|
||||
else
|
||||
commandName="$inputVal"
|
||||
gotCommand='yes'
|
||||
fi
|
||||
else
|
||||
if [ "$commandName" = 'replace' ]; then # Replace an existing file
|
||||
counter=0
|
||||
while [ "$counter" -lt "${#conffileList[@]}" ]; do
|
||||
if [ "$inputVal" = "${conffileList[$counter]}" ]; then
|
||||
mv "$inputVal.dpkg-dist" "$inputVal"
|
||||
break
|
||||
fi
|
||||
counter=$((counter+1))
|
||||
done
|
||||
elif [ "$commandName" = 'keep' ]; then # Keep an existing file
|
||||
counter=0
|
||||
while [ "$counter" -lt "${#conffileList[@]}" ]; do
|
||||
if [ "$inputVal" = "${conffileList[$counter]}" ]; then
|
||||
rm "$inputVal.dpkg-dist"
|
||||
break
|
||||
fi
|
||||
counter=$((counter+1))
|
||||
done
|
||||
fi
|
||||
gotCommand='no'
|
||||
fi
|
||||
done
|
||||
|
||||
echo 'Update installation complete.'
|
||||
fi
|
@ -0,0 +1,89 @@
|
||||
#include "ipcfilewatcher.h"
|
||||
#include "orchestrator.h"
|
||||
#include "mainwindow.h"
|
||||
#include "conffilehandlerdialog.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QDialog>
|
||||
#include <QLocale>
|
||||
#include <QProcess>
|
||||
#include <QTranslator>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
|
||||
QTranslator translator;
|
||||
const QStringList uiLanguages = QLocale::system().uiLanguages();
|
||||
for (const QString &locale : uiLanguages) {
|
||||
const QString baseName = "lubuntu-update_" + QLocale(locale).name();
|
||||
if (translator.load(":/i18n/" + baseName)) {
|
||||
a.installTranslator(&translator);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* If Lubuntu Update is already running, create
|
||||
* /dev/shm/lubuntu-update/lubuntu-update-show-win and exit. This will
|
||||
* trigger the existing process to pop up a window.
|
||||
*/
|
||||
|
||||
QProcess procDetector;
|
||||
procDetector.setProgram("/usr/bin/bash");
|
||||
procDetector.setArguments(QStringList() << "-c" << "ps axo comm | grep lubuntu-update");
|
||||
procDetector.start();
|
||||
procDetector.waitForFinished();
|
||||
QString procDetectResult = procDetector.readAllStandardOutput();
|
||||
procDetectResult = procDetectResult.trimmed();
|
||||
QStringList procDetectResultList = procDetectResult.split('\n');
|
||||
if (procDetectResultList.count() > 1) {
|
||||
QFile flagFile("/dev/shm/lubuntu-update/lubuntu-update-show-win");
|
||||
flagFile.open(QFile::WriteOnly);
|
||||
flagFile.close();
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Don't want the updater to stop just because the user closed it :P
|
||||
a.setQuitOnLastWindowClosed(false);
|
||||
|
||||
/*
|
||||
* IPCFileWatcher just watches the /dev/shm/lubuntu-update folder for the
|
||||
* creation of a lubuntu-update-show-win file. If it detects it, it
|
||||
* immediately deletes it and emits a signal. This is then used later to
|
||||
* cause the updater window to pop up.
|
||||
*/
|
||||
|
||||
IPCFileWatcher *p = new IPCFileWatcher();
|
||||
|
||||
if (p->didInitFail()) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* As this is a background process, we don't pop up any window upon
|
||||
* startup. An Orchestrator object periodically checks to see if new
|
||||
* updates have been detected, and offers them to the user (by displaying
|
||||
* a tray icon) if so. The user can click on this tray icon to see the
|
||||
* updater window.
|
||||
*
|
||||
* Orchestrator's constructor automatically starts the update checker, so
|
||||
* there's no need to do anything with this except create it and then
|
||||
* start the event loop.
|
||||
*/
|
||||
|
||||
Orchestrator *o = new Orchestrator();
|
||||
|
||||
QObject::connect(p, &IPCFileWatcher::showWindowFlagDetected, o, &Orchestrator::displayUpdater);
|
||||
|
||||
/*
|
||||
* This is an artifact from testing the conffile handler window. You can
|
||||
* uncomment this and rebuild lubuntu-update in order to test the conffile
|
||||
* handler UI and develop it further.
|
||||
*
|
||||
* ConffileHandlerDialog cfhd(QStringList() << "/home/user/testfile");
|
||||
* cfhd.show();
|
||||
*/
|
||||
|
||||
return a.exec();
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
#include "orchestrator.h"
|
||||
#include "mainwindow.h"
|
||||
#include "aptmanager.h"
|
||||
|
||||
#include <QIcon>
|
||||
#include <QSystemTrayIcon>
|
||||
#include <QTimer>
|
||||
|
||||
Orchestrator::Orchestrator(QObject *parent)
|
||||
: QObject{parent}
|
||||
{
|
||||
checkTimer = new QTimer(); // every time this triggers, the apt database is checked for new updates
|
||||
trayIcon = new QSystemTrayIcon(); // this is shown to the user to offer updates
|
||||
|
||||
connect(checkTimer, &QTimer::timeout, this, &Orchestrator::checkForUpdates);
|
||||
connect(trayIcon, &QSystemTrayIcon::activated, this, &Orchestrator::displayUpdater);
|
||||
connect(&updaterWindow, &MainWindow::updatesInstalled, this, &Orchestrator::handleUpdatesInstalled);
|
||||
|
||||
checkTimer->start(21600000); // check four times a day, at least one of those times unattended-upgrades should have refreshed the apt database
|
||||
|
||||
checkForUpdates(); // check immediately after launch, which usually will be immediately after boot or login
|
||||
}
|
||||
|
||||
/*
|
||||
* Checks the apt database to see if updated software is available, and places
|
||||
* the results in the updateInfo variable. If updated software is available,
|
||||
* show the system tray icon and trigger a notification.
|
||||
*/
|
||||
void Orchestrator::checkForUpdates()
|
||||
{
|
||||
updateInfo = AptManager::getUpdateInfo();
|
||||
if (!updateInfo[0].isEmpty() || !updateInfo[1].isEmpty() || !updateInfo[2].isEmpty() || !updateInfo[3].isEmpty()) { // no need to check updateInfo[4], it will only ever contain security updates already listed in updateInfo[1]
|
||||
trayIcon->setIcon(QPixmap(":/res/images/update.svg"));
|
||||
trayIcon->show();
|
||||
// Yes, we do intentionally use updateInfo[1], then updateInfo[0], then updateInfo[2]. The updateInfo array is populated in a different order than the one we display in.
|
||||
trayIcon->showMessage("",
|
||||
QString("Updates available!\n\n%1 to upgrade, %2 to install, and %3 to remove.\n\nClick the tray icon to install the updates.")
|
||||
.arg(QString::number(updateInfo[1].count()), QString::number(updateInfo[0].count()), QString::number(updateInfo[2].count())));
|
||||
}
|
||||
}
|
||||
|
||||
void Orchestrator::displayUpdater()
|
||||
{
|
||||
if (!updaterWindow.isLockedOpen()) {
|
||||
if (!updaterWindow.isVisible()) {
|
||||
updaterWindow.hide();
|
||||
}
|
||||
updaterWindow.setUpdateInfo(updateInfo);
|
||||
updaterWindow.show();
|
||||
}
|
||||
}
|
||||
|
||||
void Orchestrator::handleUpdatesInstalled()
|
||||
{
|
||||
// We can't clear the updateInfo list directly as MainWindow::setUpdateInfo requires that it contains five inner lists (even if those lists are all empty).
|
||||
for (int i = 0;i < 5;i++) {
|
||||
updateInfo[i].clear();
|
||||
}
|
||||
trayIcon->hide();
|
||||
}
|
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 5.1 KiB |
@ -1,193 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Backend script for Lubuntu Update (does text processing and update installation, can be run as root and must be in order to install updates)
|
||||
|
||||
set -e
|
||||
export LC_ALL='C'
|
||||
|
||||
# Returns 0 if the release is supported, 1 if unsupported, 2 if if didn't exist at all, and 3 if something went wrong.
|
||||
isReleaseSupported () {
|
||||
releaseYear="${1:-}";
|
||||
releaseMonth="${2:-}";
|
||||
metaReleaseStr="${3:-}";
|
||||
|
||||
if [ -z "$releaseYear" ]; then
|
||||
echo '! ! ! releaseYear is blank';
|
||||
return 3;
|
||||
elif [ -z "$releaseMonth" ]; then
|
||||
echo '! ! ! releaseMonth is blank';
|
||||
return 3;
|
||||
elif [ -z "$metaReleaseStr" ]; then
|
||||
echo '! ! ! metaReleaseStr is blank';
|
||||
return 3;
|
||||
fi
|
||||
|
||||
releaseCode="$releaseYear.$releaseMonth";
|
||||
scanForSupported='n';
|
||||
|
||||
while IFS= read -r line || [[ -n $line ]]; do
|
||||
if [[ "$line" =~ $releaseCode ]]; then
|
||||
scanForSupported='y';
|
||||
fi
|
||||
if [ "$scanForSupported" = 'y' ]; then
|
||||
if [[ "$line" =~ Supported ]]; then
|
||||
if [ "$(echo "$line" | cut -d':' -f2 | tail -c+2)" = '0' ]; then
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
done < <(printf '%s' "$metaReleaseStr")
|
||||
return 2;
|
||||
}
|
||||
|
||||
if [ "$1" = 'pkgver' ]; then
|
||||
shift
|
||||
while [ "$1" != '' ]; do
|
||||
source="$(apt-cache show "$1" | grep 'Source:' | cut -d' ' -f2)"
|
||||
version="$(apt-cache show "$1" | grep Version: | head -n1 | cut -d' ' -f2)"
|
||||
if [ "$source" = '' ]; then
|
||||
echo "$1"
|
||||
else
|
||||
echo "$source"
|
||||
fi
|
||||
echo "$version"
|
||||
shift
|
||||
done
|
||||
elif [ "$1" = 'checkupdate' ]; then
|
||||
apt-get -o Apt::Color='0' -o Dpkg::Use-Pty='0' update
|
||||
elif [ "$1" = 'doupdate' ]; then
|
||||
# Prepare to be able to grep through the logs
|
||||
rm /run/lubuntu-update-apt-log || true
|
||||
touch /run/lubuntu-update-apt-log
|
||||
chmod 0600 /run/lubuntu-update-apt-log # prevent non-root from being able to trick the script into deleting arbitrary files later on
|
||||
|
||||
# Repair an interrupted upgrade if necessary
|
||||
dpkg --configure -a
|
||||
|
||||
# Run the real update
|
||||
DEBIAN_FRONTEND='kde' apt-get -o Dpkg::Options::='--force-confdef' -o Dpkg::Options::='--force-confold' -o Apt::Color='0' -o Dpkg::Use-Pty='0' -y dist-upgrade |& tee /run/lubuntu-update-apt-log
|
||||
|
||||
# Find all the conffiles
|
||||
doConffiles='y';
|
||||
mapfile conffileRawList <<< "$(grep -P "^Configuration file \'.*\'$" '/run/lubuntu-update-apt-log')"
|
||||
if [ "$(echo "${conffileRawList[0]}" | head -c1)" != 'C' ]; then # Empty or invalid list, we're done
|
||||
doConffiles='n';
|
||||
fi
|
||||
|
||||
if [ "$doConffiles" = 'y' ]; then
|
||||
conffileList=()
|
||||
counter=0
|
||||
while [ "$counter" -lt "${#conffileRawList[@]}" ]; do
|
||||
# Cut off "Configuration file '" from the start and "'" plus a couple trailing characters from the end
|
||||
conffileList[counter]="$(echo "${conffileRawList[$counter]}" | tail -c+21 | head -c-3)"
|
||||
counter=$((counter+1))
|
||||
done
|
||||
|
||||
echo "Lubuntu Update !!! CONFIGURATION FILE LIST START";
|
||||
counter=0
|
||||
while [ "$counter" -lt "${#conffileList[@]}" ]; do
|
||||
echo "${conffileList[$counter]}"
|
||||
counter=$((counter+1))
|
||||
done
|
||||
echo "Lubuntu Update !!! CONFIGURATION FILE LIST END";
|
||||
|
||||
# If we make it this far, there were conffiles to deal with
|
||||
breakLoop='no'
|
||||
gotCommand='no'
|
||||
commandName=''
|
||||
while [ "$breakLoop" = 'no' ]; do
|
||||
read -r inputVal
|
||||
if [ "$gotCommand" = 'no' ]; then
|
||||
if [ "$inputVal" = 'done' ]; then
|
||||
breakLoop='yes'
|
||||
else
|
||||
commandName="$inputVal"
|
||||
gotCommand='yes'
|
||||
fi
|
||||
else
|
||||
if [ "$commandName" = 'replace' ]; then # Replace an existing file
|
||||
counter=0
|
||||
while [ "$counter" -lt "${#conffileList[@]}" ]; do
|
||||
if [ "$inputVal" = "${conffileList[$counter]}" ]; then
|
||||
mv "$inputVal.dpkg-dist" "$inputVal"
|
||||
break
|
||||
fi
|
||||
counter=$((counter+1))
|
||||
done
|
||||
elif [ "$commandName" = 'keep' ]; then # Keep an existing file
|
||||
counter=0
|
||||
while [ "$counter" -lt "${#conffileList[@]}" ]; do
|
||||
if [ "$inputVal" = "${conffileList[$counter]}" ]; then
|
||||
rm "$inputVal.dpkg-dist"
|
||||
break
|
||||
fi
|
||||
counter=$((counter+1))
|
||||
done
|
||||
fi
|
||||
gotCommand='no'
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
echo 'Checking release status...'
|
||||
|
||||
releaseCode="$(cat /etc/lsb-release | grep "DISTRIB_RELEASE" | cut -d'=' -f2)";
|
||||
releaseYear="$(cut -d'.' -f1 <<< "$releaseCode")";
|
||||
releaseMonth="$(cut -d'.' -f2 <<< "$releaseCode")";
|
||||
metaReleaseData="$(curl https://changelogs.ubuntu.com/meta-release)";
|
||||
#nextReleaseMonth='';
|
||||
#nextReleaseYear='';
|
||||
#nextLTSReleaseMonth='';
|
||||
#nextLTSReleaseYear='';
|
||||
|
||||
while true; do
|
||||
if ((releaseMonth == 4)); then
|
||||
releaseMonth='10';
|
||||
else
|
||||
releaseMonth='04';
|
||||
((releaseYear++));
|
||||
fi
|
||||
releaseSupportedResult="$(isReleaseSupported "$releaseYear" "$releaseMonth" "$metaReleaseData"; echo "$?")";
|
||||
if [ "$releaseSupportedResult" = '0' ]; then
|
||||
echo 'Lubuntu Update !!! NEW RELEASE';
|
||||
echo "$releaseYear.$releaseMonth";
|
||||
elif [ "$releaseSupportedResult" = '2' ]; then
|
||||
break;
|
||||
fi
|
||||
done
|
||||
|
||||
# if ((releaseMonth == 4)); then
|
||||
# nextReleaseMonth=$((releaseMonth + 6));
|
||||
# nextReleaseYear="$releaseYear";
|
||||
# if (((releaseYear % 2) == 0)); then
|
||||
# nextLTSReleaseMonth='04';
|
||||
# nextLTSReleaseYear=$((releaseYear + 2));
|
||||
# fi
|
||||
# else
|
||||
# nextReleaseMonth="$releaseMonth";
|
||||
# nextReleaseYear=$((releaseYear + 1));
|
||||
# fi
|
||||
#
|
||||
# if [ -n "$nextLTSReleaseYear" ]; then
|
||||
# if isReleaseSupported "$nextLTSReleaseYear" "$nextLTSReleaseMonth" "$metaReleaseData"; then
|
||||
# echo 'Lubuntu Update !!! NEW RELEASE';
|
||||
# echo "$nextLTSReleaseYear.$nextLTSReleaseMonth";
|
||||
# fi
|
||||
# fi
|
||||
#
|
||||
# if ! (((nextReleaseYear == nextLTSReleaseYear) && (nextReleaseMonth == nextLTSReleaseMonth))); then
|
||||
# if isReleaseSupported "$nextReleaseYear" "$nextReleaseMonth" "$metaReleaseData"; then
|
||||
# echo 'Lubuntu Update !!! NEW RELEASE';
|
||||
# echo "$nextReleaseYear.$nextReleaseMonth";
|
||||
# else
|
||||
# echo "Unsupported release: $nextReleaseYear.$nextReleaseMonth";
|
||||
# fi
|
||||
# fi
|
||||
|
||||
echo 'Update installation complete.'
|
||||
elif [ "$1" = 'doReleaseUpgrade' ]; then
|
||||
do-release-upgrade -m desktop -f DistUpgradeViewKDE;
|
||||
elif [ "$1" = 'declineReleaseUpgrade' ]; then
|
||||
sed -i -E 's/^Prompt=(never|lts|normal)$/Prompt=never/' /etc/update-manager/release-upgrades;
|
||||
fi
|
@ -1,125 +0,0 @@
|
||||
#include "windowshowwatcher.h"
|
||||
#include "orchestrator.h"
|
||||
#include "mainwindow.h"
|
||||
#include "conffilehandlerdialog.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QDBusConnection>
|
||||
#include <QDBusError>
|
||||
#include <QDBusInterface>
|
||||
#include <QDebug>
|
||||
#include <QDialog>
|
||||
#include <QLocale>
|
||||
#include <QProcess>
|
||||
#include <QThread>
|
||||
#include <QTranslator>
|
||||
|
||||
/*
|
||||
* Detects if at least `count` processes that match `procName` are running.
|
||||
*/
|
||||
bool detectProc(QString procName, int count)
|
||||
{
|
||||
QProcess procDetector;
|
||||
procDetector.setProgram("/usr/bin/bash");
|
||||
procDetector.setArguments(QStringList() << "-c" << "ps axo comm | grep " + procName);
|
||||
procDetector.start();
|
||||
procDetector.waitForFinished();
|
||||
QString procDetectResult = procDetector.readAllStandardOutput();
|
||||
procDetectResult = procDetectResult.trimmed();
|
||||
QStringList procDetectResultList = procDetectResult.split('\n');
|
||||
if (procDetectResultList.count() >= count) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
|
||||
QTranslator translator;
|
||||
const QStringList uiLanguages = QLocale::system().uiLanguages();
|
||||
for (const QString &locale : uiLanguages) {
|
||||
const QString baseName = QLocale(locale).name();
|
||||
if (translator.load(":/i18n/" + baseName)) {
|
||||
a.installTranslator(&translator);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Connect to D-Bus.
|
||||
auto dbusConnection = QDBusConnection::sessionBus();
|
||||
|
||||
/*
|
||||
* If Lubuntu Update is already running, instruct the running instance to
|
||||
* display its window via the D-Bus connection.
|
||||
*/
|
||||
if (detectProc("lubuntu-update", 2)) {
|
||||
auto iface = new QDBusInterface("me.lubuntu.LubuntuUpdate.window", "/", "me.lubuntu.LubuntuUpdate.window", dbusConnection);
|
||||
if (!iface->isValid()) {
|
||||
qWarning().noquote() << dbusConnection.lastError().message();
|
||||
return 1;
|
||||
}
|
||||
iface->call("showWindow");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Wait to run until lxqt-notificationd is running. This avoids a bug that
|
||||
* causes notifications to show up in the entirely wrong spot. If it takes
|
||||
* longer than about 30 seconds to show up, we continue on without it for
|
||||
* the sake of getting security updates.
|
||||
*/
|
||||
for (int i = 0;i < 30;i++) {
|
||||
// "lxqt-notificati" is intentionally truncated here since that's how it shows up in the output of `ps axo comm`.
|
||||
if (detectProc("lxqt-notificati", 1)) {
|
||||
// Wait for it to initialize fully - 3 seconds should be way more than enough
|
||||
QThread::sleep(3);
|
||||
break;
|
||||
} else {
|
||||
QThread::sleep(1);
|
||||
}
|
||||
}
|
||||
|
||||
// Don't want the updater to stop just because the user closed it :P
|
||||
a.setQuitOnLastWindowClosed(false);
|
||||
|
||||
/*
|
||||
* WindowShowWatcher is a very simple D-Bus service that allow triggering
|
||||
* the Lubuntu Update window to be shown. If anything calls "showWindow"
|
||||
* on this service, Lubuntu Update's window will pop up.
|
||||
*/
|
||||
QObject obj;
|
||||
auto *wsw = new WindowShowWatcher(&obj);
|
||||
dbusConnection.registerObject("/", &obj);
|
||||
|
||||
if (!dbusConnection.registerService("me.lubuntu.LubuntuUpdate.window")) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* As this is a background process, we don't pop up any window upon
|
||||
* startup. An Orchestrator object periodically checks to see if new
|
||||
* updates have been detected, and offers them to the user (by displaying
|
||||
* a tray icon) if so. The user can click on this tray icon to see the
|
||||
* updater window.
|
||||
*
|
||||
* Orchestrator's constructor automatically starts the update checker, so
|
||||
* there's no need to do anything with this except create it and then
|
||||
* start the event loop.
|
||||
*/
|
||||
Orchestrator *o = new Orchestrator();
|
||||
|
||||
QObject::connect(wsw, &WindowShowWatcher::showWindowTriggered, o, &Orchestrator::displayUpdater);
|
||||
|
||||
/*
|
||||
* This is an artifact from testing the conffile handler window. You can
|
||||
* uncomment this and rebuild lubuntu-update in order to test the conffile
|
||||
* handler UI and develop it further.
|
||||
*
|
||||
* ConffileHandlerDialog cfhd(QStringList() << "/home/user/testfile");
|
||||
* cfhd.show();
|
||||
*/
|
||||
|
||||
return a.exec();
|
||||
}
|
@ -1,188 +0,0 @@
|
||||
#include "orchestrator.h"
|
||||
#include "mainwindow.h"
|
||||
#include "aptmanager.h"
|
||||
#include "releaseupgradewindow.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QIcon>
|
||||
#include <QProcess>
|
||||
#include <QSystemTrayIcon>
|
||||
#include <QTimer>
|
||||
|
||||
Orchestrator::Orchestrator(QObject *parent)
|
||||
: QObject{parent}
|
||||
{
|
||||
checkTimer = new QTimer(); // every time this triggers, the apt database is checked for new updates
|
||||
trayIcon = new QSystemTrayIcon(); // this is shown to the user to offer updates
|
||||
|
||||
/*
|
||||
* Parse the Lubuntu Update config file. It contains two critical pieces
|
||||
* of info - when the system last offered the user a release upgrade,
|
||||
* and whether the user has disabled release upgrade notifications.
|
||||
*/
|
||||
QFile configFile(QDir::homePath() + "/.config/lubuntu-update.conf");
|
||||
bool success = configFile.open(QFile::ReadOnly);
|
||||
if (success) {
|
||||
char lineBuf[2048];
|
||||
while (!configFile.atEnd()) {
|
||||
configFile.readLine(lineBuf, 2048);
|
||||
QString line(lineBuf);
|
||||
line = line.trimmed();
|
||||
QStringList lineParts = line.split("=");
|
||||
if (lineParts.count() == 2) {
|
||||
if (lineParts[0] == "nextDoReleaseUpgradeNotify") {
|
||||
nextUpgradeCheck = QDateTime::fromSecsSinceEpoch(lineParts[1].toLongLong());
|
||||
} else {
|
||||
qWarning() << "Unrecognized config line: " << line;
|
||||
}
|
||||
} else {
|
||||
qWarning() << "Wrong number of fields in line: " << line;
|
||||
}
|
||||
}
|
||||
}
|
||||
configFile.close();
|
||||
|
||||
connect(checkTimer, &QTimer::timeout, this, &Orchestrator::checkForUpdates);
|
||||
connect(trayIcon, &QSystemTrayIcon::activated, this, &Orchestrator::displayUpdater);
|
||||
connect(&updaterWindow, &MainWindow::updatesInstalled, this, &Orchestrator::handleUpdatesInstalled);
|
||||
connect(&updaterWindow, &MainWindow::updatesRefreshed, this, &Orchestrator::handleUpdatesRefreshed);
|
||||
connect(&updaterWindow, &MainWindow::newReleaseAvailable, this, &Orchestrator::onNewReleaseAvailable);
|
||||
|
||||
checkTimer->start(21600000); // check four times a day, at least one of those times unattended-upgrades should have refreshed the apt database
|
||||
|
||||
checkForUpdates(); // check immediately after launch, which usually will be immediately after boot or login
|
||||
}
|
||||
|
||||
/*
|
||||
* Checks the apt database to see if updated software is available, and places
|
||||
* the results in the updateInfo variable. If updated software is available,
|
||||
* show the system tray icon and trigger a notification.
|
||||
*/
|
||||
void Orchestrator::checkForUpdates()
|
||||
{
|
||||
updateInfo = AptManager::getUpdateInfo();
|
||||
if (!updateInfo[0].isEmpty() || !updateInfo[1].isEmpty() || !updateInfo[2].isEmpty() || !updateInfo[3].isEmpty()) { // no need to check updateInfo[4], it will only ever contain security updates already listed in updateInfo[1]
|
||||
trayIcon->setIcon(QPixmap(":/res/images/update.svg"));
|
||||
trayIcon->show();
|
||||
// Yes, we do intentionally use updateInfo[1], then updateInfo[0], then updateInfo[2]. The updateInfo array is populated in a different order than the one we display in.
|
||||
trayIcon->showMessage("",
|
||||
tr("Updates available!\n\n%1 to upgrade, %2 to install, and %3 to remove.\n\nClick the tray icon to install the updates.")
|
||||
.arg(QString::number(updateInfo[1].count()), QString::number(updateInfo[0].count()), QString::number(updateInfo[2].count())));
|
||||
}
|
||||
}
|
||||
|
||||
void Orchestrator::displayUpdater()
|
||||
{
|
||||
if (!updaterWindow.isLockedOpen()) {
|
||||
if (!updaterWindow.isVisible()) {
|
||||
updaterWindow.hide();
|
||||
}
|
||||
updaterWindow.setUpdateInfo(updateInfo);
|
||||
updaterWindow.show();
|
||||
}
|
||||
}
|
||||
|
||||
void Orchestrator::handleUpdatesInstalled()
|
||||
{
|
||||
// We can't clear the updateInfo list directly as MainWindow::setUpdateInfo requires that it contains five inner lists (even if those lists are all empty).
|
||||
for (int i = 0;i < 5;i++) {
|
||||
updateInfo[i].clear();
|
||||
}
|
||||
trayIcon->hide();
|
||||
}
|
||||
|
||||
void Orchestrator::handleUpdatesRefreshed()
|
||||
{
|
||||
checkForUpdates();
|
||||
displayUpdater();
|
||||
}
|
||||
|
||||
void Orchestrator::onNewReleaseAvailable(QStringList releaseCodes)
|
||||
{
|
||||
// First, determine what kinds of releases the user wants to see.
|
||||
QFile druTypeFile("/etc/update-manager/release-upgrades");
|
||||
bool success = druTypeFile.open(QFile::ReadOnly);
|
||||
QString druType;
|
||||
if (success) {
|
||||
char lineBuf[2048];
|
||||
while (!druTypeFile.atEnd()) {
|
||||
druTypeFile.readLine(lineBuf, 2048);
|
||||
QString line(lineBuf);
|
||||
line = line.trimmed();
|
||||
if (line == "Prompt=lts") {
|
||||
druType="lts";
|
||||
druTypeFile.close();
|
||||
break;
|
||||
} else if (line == "Prompt=none") {
|
||||
// The user has disabled all upgrade prompts.
|
||||
druTypeFile.close();
|
||||
return;
|
||||
} else if (line == "Prompt=normal") {
|
||||
druType="normal";
|
||||
druTypeFile.close();
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
druType="normal";
|
||||
druTypeFile.close();
|
||||
}
|
||||
|
||||
for (int i = 0;i < releaseCodes.count();i++) {
|
||||
QStringList releaseCodeParts = releaseCodes[i].split('.');
|
||||
if (releaseCodeParts.count() >= 2) {
|
||||
int releaseYear = releaseCodeParts[0].toInt();
|
||||
int releaseMonth = releaseCodeParts[1].toInt();
|
||||
if (((releaseYear % 2 == 0) && (releaseMonth == 4)) || druType == "normal") {
|
||||
QDateTime now = QDateTime::currentDateTime();
|
||||
if (nextUpgradeCheck < now) {
|
||||
ReleaseUpgradeWindow upgradeWindow(releaseCodes[i]);
|
||||
upgradeWindow.exec();
|
||||
if (upgradeWindow.getUpgradeAccepted()) {
|
||||
doReleaseUpgrade();
|
||||
} else if (upgradeWindow.getUpgradeDelayStamp() > 0) {
|
||||
delayReleaseUpgrade(upgradeWindow.getUpgradeDelayStamp());
|
||||
} else {
|
||||
declineReleaseUpgrade();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Orchestrator::doReleaseUpgrade()
|
||||
{
|
||||
QProcess druProcess;
|
||||
druProcess.setProgram("/usr/bin/lxqt-sudo");
|
||||
druProcess.setArguments(QStringList() << "/usr/libexec/lubuntu-update-backend" << "doReleaseUpgrade");
|
||||
druProcess.start();
|
||||
druProcess.waitForFinished(-1);
|
||||
}
|
||||
|
||||
void Orchestrator::delayReleaseUpgrade(qint64 timestamp)
|
||||
{
|
||||
QFile configFile(QDir::homePath() + "/.config/lubuntu-update.conf");
|
||||
bool success = configFile.open(QFile::WriteOnly);
|
||||
if (success) {
|
||||
configFile.write("nextDoReleaseUpgradeNotify=");
|
||||
configFile.write(QString::number(timestamp).toUtf8());
|
||||
configFile.write("\n");
|
||||
} else {
|
||||
qWarning() << "Could not write to " + QDir::homePath() + "/.config/lubuntu-update.conf, check permissions";
|
||||
}
|
||||
configFile.close();
|
||||
nextUpgradeCheck = QDateTime::fromSecsSinceEpoch(timestamp);
|
||||
}
|
||||
|
||||
void Orchestrator::declineReleaseUpgrade()
|
||||
{
|
||||
QProcess druProcess;
|
||||
druProcess.setProgram("/usr/bin/lxqt-sudo");
|
||||
druProcess.setArguments(QStringList() << "/usr/libexec/lubuntu-update-backend" << "declineReleaseUpgrade");
|
||||
druProcess.start();
|
||||
druProcess.waitForFinished(-1);
|
||||
}
|
@ -1,67 +0,0 @@
|
||||
#include "releaseupgradewindow.h"
|
||||
#include "ui_releaseupgradewindow.h"
|
||||
|
||||
#include "upgradedelaywindow.h"
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QMessageBox>
|
||||
|
||||
ReleaseUpgradeWindow::ReleaseUpgradeWindow(QString releaseCode, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::ReleaseUpgradeWindow)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->upgradeLabel->setText(tr("An upgrade to Lubuntu %1 is available! Would you like to install this upgrade now?").arg(releaseCode));
|
||||
code=releaseCode;
|
||||
connect(ui->upgradeButton, &QPushButton::clicked, this, &ReleaseUpgradeWindow::onUpgradeClicked);
|
||||
connect(ui->remindButton, &QPushButton::clicked, this, &ReleaseUpgradeWindow::onRemindClicked);
|
||||
connect(ui->declineButton, &QPushButton::clicked, this, &ReleaseUpgradeWindow::onDeclineClicked);
|
||||
}
|
||||
|
||||
ReleaseUpgradeWindow::~ReleaseUpgradeWindow()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
bool ReleaseUpgradeWindow::getUpgradeAccepted()
|
||||
{
|
||||
return upgradeAccepted;
|
||||
}
|
||||
|
||||
qint64 ReleaseUpgradeWindow::getUpgradeDelayStamp()
|
||||
{
|
||||
return upgradeDelayStamp;
|
||||
}
|
||||
|
||||
void ReleaseUpgradeWindow::onUpgradeClicked()
|
||||
{
|
||||
upgradeAccepted = true;
|
||||
this->done(0);
|
||||
}
|
||||
|
||||
void ReleaseUpgradeWindow::onRemindClicked()
|
||||
{
|
||||
UpgradeDelayWindow delayWindow;
|
||||
delayWindow.exec();
|
||||
if (delayWindow.getDelayDays() > 0) {
|
||||
QDateTime delayDateTime = QDateTime::currentDateTime();
|
||||
delayDateTime = delayDateTime.addDays(delayWindow.getDelayDays());
|
||||
upgradeAccepted = false;
|
||||
upgradeDelayStamp = delayDateTime.toSecsSinceEpoch();
|
||||
this->done(0);
|
||||
}
|
||||
}
|
||||
|
||||
void ReleaseUpgradeWindow::onDeclineClicked()
|
||||
{
|
||||
QMessageBox confirmDialog;
|
||||
confirmDialog.setWindowTitle(tr("Lubuntu Update"));
|
||||
confirmDialog.setText(tr("You have declined the upgrade to Lubuntu %1.\nYou can upgrade manually by following the directions at https://manual.lubuntu.me/stable/D/upgrading.html.").arg(code));
|
||||
confirmDialog.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
|
||||
int result = confirmDialog.exec();
|
||||
if (result == QMessageBox::Ok) {
|
||||
upgradeDelayStamp = 0;
|
||||
upgradeAccepted = false;
|
||||
this->done(0);
|
||||
}
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
#ifndef RELEASEUPGRADEWINDOW_H
|
||||
#define RELEASEUPGRADEWINDOW_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui {
|
||||
class ReleaseUpgradeWindow;
|
||||
}
|
||||
|
||||
class ReleaseUpgradeWindow : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ReleaseUpgradeWindow(QString releaseCode, QWidget *parent = nullptr);
|
||||
~ReleaseUpgradeWindow();
|
||||
bool getUpgradeAccepted();
|
||||
qint64 getUpgradeDelayStamp();
|
||||
|
||||
private slots:
|
||||
void onUpgradeClicked();
|
||||
void onRemindClicked();
|
||||
void onDeclineClicked();
|
||||
|
||||
private:
|
||||
Ui::ReleaseUpgradeWindow *ui;
|
||||
QString code;
|
||||
bool upgradeAccepted = false;
|
||||
qint64 upgradeDelayStamp = 0;
|
||||
};
|
||||
|
||||
#endif // RELEASEUPGRADEWINDOW_H
|
@ -1,69 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ReleaseUpgradeWindow</class>
|
||||
<widget class="QDialog" name="ReleaseUpgradeWindow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>393</width>
|
||||
<height>116</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Lubuntu Update</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="upgradeLabel">
|
||||
<property name="text">
|
||||
<string>upgrade available</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>6</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="upgradeButton">
|
||||
<property name="text">
|
||||
<string>Upgrade Now</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="remindButton">
|
||||
<property name="text">
|
||||
<string>Remind me later</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="declineButton">
|
||||
<property name="text">
|
||||
<string>Decline Upgrade</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@ -1,7 +0,0 @@
|
||||
<RCC>
|
||||
<qresource prefix="/i18n">
|
||||
<file alias="en_US">lubuntu-update_en_US.qm</file>
|
||||
<file alias="es_ES">lubuntu-update_es_ES.qm</file>
|
||||
<file alias="zh_CN">lubuntu-update_zh_CN.qm</file>
|
||||
</qresource>
|
||||
</RCC>
|
@ -1,143 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1" language="en_US">
|
||||
<context>
|
||||
<name>ConffileHandlerDialog</name>
|
||||
<message>
|
||||
<location filename="../conffilehandlerdialog.ui" line="14"/>
|
||||
<source>Configuration File Conflicts</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../conffilehandlerdialog.ui" line="24"/>
|
||||
<source><html><head/><body><p>Some of the newly installed updates have updated configuration files. </p><p>Please choose what to do with these files.</p></body></html></source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../conffilehandlerdialog.ui" line="81"/>
|
||||
<source>Done</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ConffileWidget</name>
|
||||
<message>
|
||||
<location filename="../conffilewidget.ui" line="14"/>
|
||||
<source>Form</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../conffilewidget.ui" line="20"/>
|
||||
<source>Filename</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../conffilewidget.ui" line="40"/>
|
||||
<source>Keep old</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../conffilewidget.ui" line="47"/>
|
||||
<source>Replace with new</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../conffilewidget.ui" line="54"/>
|
||||
<source>Show diff</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>DiffDisplayDialog</name>
|
||||
<message>
|
||||
<location filename="../diffdisplaydialog.ui" line="14"/>
|
||||
<source>Dialog</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../diffdisplaydialog.ui" line="24"/>
|
||||
<source><html><head/><body><p>Lines that start with a &quot;+&quot; only exist in the <span style=" font-weight:700;">new</span> file.</p><p>Lines that start with a &quot;-&quot; only exist in the <span style=" font-weight:700;">old</span> file.</p></body></html></source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../diffdisplaydialog.ui" line="56"/>
|
||||
<source>Done</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>MainWindow</name>
|
||||
<message>
|
||||
<location filename="../mainwindow.ui" line="14"/>
|
||||
<source>Lubuntu Update</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.ui" line="25"/>
|
||||
<source>0 package(s) will be updated. 0 of these updates are security-related.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.ui" line="33"/>
|
||||
<source>Packages</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.ui" line="80"/>
|
||||
<source>Install Updates</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.ui" line="91"/>
|
||||
<source>Check for Updates</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.ui" line="98"/>
|
||||
<source>Close</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.cpp" line="53"/>
|
||||
<source>To be installed</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.cpp" line="56"/>
|
||||
<source>To be upgraded</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.cpp" line="59"/>
|
||||
<source>To be removed</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.cpp" line="62"/>
|
||||
<source>Held back (usually temporarily)</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.cpp" line="73"/>
|
||||
<source>%1 package(s) will be updated. %2 of these updates are security-related.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.cpp" line="139"/>
|
||||
<source>Update installation complete.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Orchestrator</name>
|
||||
<message>
|
||||
<location filename="../orchestrator.cpp" line="38"/>
|
||||
<source>Updates available!
|
||||
|
||||
%1 to upgrade, %2 to install, and %3 to remove.
|
||||
|
||||
Click the tray icon to install the updates.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
@ -1,143 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1" language="es_ES">
|
||||
<context>
|
||||
<name>ConffileHandlerDialog</name>
|
||||
<message>
|
||||
<location filename="../conffilehandlerdialog.ui" line="14"/>
|
||||
<source>Configuration File Conflicts</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../conffilehandlerdialog.ui" line="24"/>
|
||||
<source><html><head/><body><p>Some of the newly installed updates have updated configuration files. </p><p>Please choose what to do with these files.</p></body></html></source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../conffilehandlerdialog.ui" line="81"/>
|
||||
<source>Done</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ConffileWidget</name>
|
||||
<message>
|
||||
<location filename="../conffilewidget.ui" line="14"/>
|
||||
<source>Form</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../conffilewidget.ui" line="20"/>
|
||||
<source>Filename</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../conffilewidget.ui" line="40"/>
|
||||
<source>Keep old</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../conffilewidget.ui" line="47"/>
|
||||
<source>Replace with new</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../conffilewidget.ui" line="54"/>
|
||||
<source>Show diff</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>DiffDisplayDialog</name>
|
||||
<message>
|
||||
<location filename="../diffdisplaydialog.ui" line="14"/>
|
||||
<source>Dialog</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../diffdisplaydialog.ui" line="24"/>
|
||||
<source><html><head/><body><p>Lines that start with a &quot;+&quot; only exist in the <span style=" font-weight:700;">new</span> file.</p><p>Lines that start with a &quot;-&quot; only exist in the <span style=" font-weight:700;">old</span> file.</p></body></html></source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../diffdisplaydialog.ui" line="56"/>
|
||||
<source>Done</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>MainWindow</name>
|
||||
<message>
|
||||
<location filename="../mainwindow.ui" line="14"/>
|
||||
<source>Lubuntu Update</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.ui" line="25"/>
|
||||
<source>0 package(s) will be updated. 0 of these updates are security-related.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.ui" line="33"/>
|
||||
<source>Packages</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.ui" line="80"/>
|
||||
<source>Install Updates</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.ui" line="91"/>
|
||||
<source>Check for Updates</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.ui" line="98"/>
|
||||
<source>Close</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.cpp" line="53"/>
|
||||
<source>To be installed</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.cpp" line="56"/>
|
||||
<source>To be upgraded</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.cpp" line="59"/>
|
||||
<source>To be removed</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.cpp" line="62"/>
|
||||
<source>Held back (usually temporarily)</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.cpp" line="73"/>
|
||||
<source>%1 package(s) will be updated. %2 of these updates are security-related.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.cpp" line="139"/>
|
||||
<source>Update installation complete.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Orchestrator</name>
|
||||
<message>
|
||||
<location filename="../orchestrator.cpp" line="38"/>
|
||||
<source>Updates available!
|
||||
|
||||
%1 to upgrade, %2 to install, and %3 to remove.
|
||||
|
||||
Click the tray icon to install the updates.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
@ -1,143 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1" language="zh_CN">
|
||||
<context>
|
||||
<name>ConffileHandlerDialog</name>
|
||||
<message>
|
||||
<location filename="../conffilehandlerdialog.ui" line="14"/>
|
||||
<source>Configuration File Conflicts</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../conffilehandlerdialog.ui" line="24"/>
|
||||
<source><html><head/><body><p>Some of the newly installed updates have updated configuration files. </p><p>Please choose what to do with these files.</p></body></html></source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../conffilehandlerdialog.ui" line="81"/>
|
||||
<source>Done</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ConffileWidget</name>
|
||||
<message>
|
||||
<location filename="../conffilewidget.ui" line="14"/>
|
||||
<source>Form</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../conffilewidget.ui" line="20"/>
|
||||
<source>Filename</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../conffilewidget.ui" line="40"/>
|
||||
<source>Keep old</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../conffilewidget.ui" line="47"/>
|
||||
<source>Replace with new</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../conffilewidget.ui" line="54"/>
|
||||
<source>Show diff</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>DiffDisplayDialog</name>
|
||||
<message>
|
||||
<location filename="../diffdisplaydialog.ui" line="14"/>
|
||||
<source>Dialog</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../diffdisplaydialog.ui" line="24"/>
|
||||
<source><html><head/><body><p>Lines that start with a &quot;+&quot; only exist in the <span style=" font-weight:700;">new</span> file.</p><p>Lines that start with a &quot;-&quot; only exist in the <span style=" font-weight:700;">old</span> file.</p></body></html></source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../diffdisplaydialog.ui" line="56"/>
|
||||
<source>Done</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>MainWindow</name>
|
||||
<message>
|
||||
<location filename="../mainwindow.ui" line="14"/>
|
||||
<source>Lubuntu Update</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.ui" line="25"/>
|
||||
<source>0 package(s) will be updated. 0 of these updates are security-related.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.ui" line="33"/>
|
||||
<source>Packages</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.ui" line="80"/>
|
||||
<source>Install Updates</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.ui" line="91"/>
|
||||
<source>Check for Updates</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.ui" line="98"/>
|
||||
<source>Close</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.cpp" line="53"/>
|
||||
<source>To be installed</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.cpp" line="56"/>
|
||||
<source>To be upgraded</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.cpp" line="59"/>
|
||||
<source>To be removed</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.cpp" line="62"/>
|
||||
<source>Held back (usually temporarily)</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.cpp" line="73"/>
|
||||
<source>%1 package(s) will be updated. %2 of these updates are security-related.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.cpp" line="139"/>
|
||||
<source>Update installation complete.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Orchestrator</name>
|
||||
<message>
|
||||
<location filename="../orchestrator.cpp" line="38"/>
|
||||
<source>Updates available!
|
||||
|
||||
%1 to upgrade, %2 to install, and %3 to remove.
|
||||
|
||||
Click the tray icon to install the updates.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
@ -1,42 +0,0 @@
|
||||
#include "upgradedelaywindow.h"
|
||||
#include "ui_upgradedelaywindow.h"
|
||||
|
||||
UpgradeDelayWindow::UpgradeDelayWindow(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::UpgradeDelayWindow)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
connect(ui->okButton, &QPushButton::clicked, this, &UpgradeDelayWindow::onOkClicked);
|
||||
connect(ui->cancelButton, &QPushButton::clicked, this, &UpgradeDelayWindow::onCancelClicked);
|
||||
}
|
||||
|
||||
UpgradeDelayWindow::~UpgradeDelayWindow()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
qint64 UpgradeDelayWindow::getDelayDays()
|
||||
{
|
||||
return delayDays;
|
||||
}
|
||||
|
||||
void UpgradeDelayWindow::onOkClicked()
|
||||
{
|
||||
switch (ui->timeTypeComboBox->currentIndex()) {
|
||||
case 0: // days
|
||||
delayDays = ui->timeSpinBox->value();
|
||||
break;
|
||||
case 1: // weeks
|
||||
delayDays = ui->timeSpinBox->value() * 7;
|
||||
break;
|
||||
case 2: // months
|
||||
delayDays = ui->timeSpinBox->value() * 28;
|
||||
break;
|
||||
}
|
||||
this->done(0);
|
||||
}
|
||||
|
||||
void UpgradeDelayWindow::onCancelClicked()
|
||||
{
|
||||
this->done(0);
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
#ifndef UPGRADEDELAYWINDOW_H
|
||||
#define UPGRADEDELAYWINDOW_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui {
|
||||
class UpgradeDelayWindow;
|
||||
}
|
||||
|
||||
class UpgradeDelayWindow : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit UpgradeDelayWindow(QWidget *parent = nullptr);
|
||||
~UpgradeDelayWindow();
|
||||
qint64 getDelayDays();
|
||||
|
||||
private slots:
|
||||
void onOkClicked();
|
||||
void onCancelClicked();
|
||||
|
||||
private:
|
||||
Ui::UpgradeDelayWindow *ui;
|
||||
qint64 delayDays;
|
||||
};
|
||||
|
||||
#endif // UPGRADEDELAYWINDOW_H
|
@ -1,97 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>UpgradeDelayWindow</class>
|
||||
<widget class="QDialog" name="UpgradeDelayWindow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>242</width>
|
||||
<height>137</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Lubuntu Update</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p>How long would you like to wait before being reminded of the upgrade again?</p></body></html></string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="1">
|
||||
<widget class="QSpinBox" name="timeSpinBox"/>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QPushButton" name="okButton">
|
||||
<property name="text">
|
||||
<string>OK</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QPushButton" name="cancelButton">
|
||||
<property name="text">
|
||||
<string>Cancel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QComboBox" name="timeTypeComboBox">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Days</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Weeks</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Months</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@ -1,6 +0,0 @@
|
||||
#include "windowshowwatcher.h"
|
||||
|
||||
void WindowShowWatcher::showWindow()
|
||||
{
|
||||
emit showWindowTriggered();
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
#ifndef WINDOWSHOWWATCHER_H
|
||||
#define WINDOWSHOWWATCHER_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QDBusAbstractAdaptor>
|
||||
#include <QDBusVariant>
|
||||
|
||||
class WindowShowWatcher : public QDBusAbstractAdaptor
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_CLASSINFO("D-Bus Interface", "me.lubuntu.LubuntuUpdate.window")
|
||||
|
||||
public:
|
||||
explicit WindowShowWatcher(QObject *obj) : QDBusAbstractAdaptor(obj) {}
|
||||
|
||||
public slots:
|
||||
void showWindow();
|
||||
|
||||
signals:
|
||||
void showWindowTriggered();
|
||||
};
|
||||
|
||||
#endif // WINDOWSHOWWATCHER_H
|
@ -0,0 +1,3 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1" language="en_US"></TS>
|
Loading…
Reference in new issue