Merge branch 'feature-release-test' into develop

This commit is contained in:
Ximi1970
2020-03-22 21:35:23 +01:00
18 changed files with 580 additions and 33 deletions

View File

@@ -1,9 +1,20 @@
QMAKE = qmake-qt5
ifeq (, $(shell which qmake-qt5 2>/dev/null))
ifeq (, $(shell which qmake 2>/dev/null))
SYSTEM =
ifeq (Cygwin,$(shell uname -o))
SYSTEM = Windows
else
ifeq (GNU/Linux,$(shell uname -o))
SYSTEM = Linux
QMAKE = qmake-qt5
ifeq (, $(shell which qmake-qt5 2>/dev/null))
ifeq (, $(shell which qmake 2>/dev/null))
$(error "No qmake in $(PATH)")
endif
QMAKE = qmake
endif
QMAKE = qmake
else
$(error "Unknown system")
endif
endif
.PHONY: clean \
@@ -27,14 +38,19 @@ clean:
rm -f *.xpi ;\
rm -f SysTray-X ;\
rm -rf app/build ;\
rm -rf app/build32 ;\
rm -rf app/build64 ;\
rm -rf app/build-* ;\
rm -rf app/dist* ;\
systray-x-xpi:
@echo "Creating systray-x.xpi" ;\
rm -f systray-x.xpi ;\
@echo "Creating systray-x@Ximi1970.xpi" ;\
rm -f systray-x@Ximi1970.xpi ;\
cd webext ;\
zip ../systray-x.xpi -qr * ;\
zip ../systray-x@Ximi1970.xpi -qr * ;\
cd ..
ifeq (Linux,$(SYSTEM))
systray-x-app:
@echo "Creating systray-x app" ;\
rm -f SysTray-X ;\
@@ -44,3 +60,17 @@ systray-x-app:
make ;\
cd ../.. ;\
cp app/build/SysTray-X .
else
systray-x-app:
@echo "Creating systray-x app" ;\
rm -f SysTray-X ;\
mkdir -p app/build32 ;\
mkdir -p app/dist/win32 ;\
cd app/build32 ;\
../build.bat x86 5.14.1 ;\
cd ../.. ;\
mkdir -p app/build64 ;\
cd app/build64 ;\
../build.bat x86_64 5.14.1 ;\
cd ../..
endif

View File

@@ -9,8 +9,73 @@ The add-on and system tray application can do:
- show / hide Thunderbird (minimize)
- minimizing hides to tray
- minimize on startup
- to be implemented: start a new mail
- to be implemented: open the last used account
## Binaries (System)
These packages will install the Thunderbird Add-on and companion app system wide.
Root credentials are required.
### openSuSE
#### Leap 15.1
```bash
sudo zypper ar -f https://download.opensuse.org/repositories/home:/Ximi1970:/Mozilla:/Add-ons/openSUSE_Leap_15.1/ SysTray-X
sudo zypper in systray-x
```
#### Leap 15.2
```bash
sudo zypper ar -f https://download.opensuse.org/repositories/home:/Ximi1970:/Mozilla:/Add-ons/openSUSE_Leap_15.2/ SysTray-X
sudo zypper in systray-x
```
#### Tumbleweed
```bash
sudo zypper ar -f https://download.opensuse.org/repositories/home:/Ximi1970:/Mozilla:/Add-ons/openSUSE_Tumbleweed/ SysTray-X
sudo zypper in systray-x
```
#### SLE 15
```bash
sudo zypper ar -f https://download.opensuse.org/repositories/home:/Ximi1970:/Mozilla:/Add-ons/openSUSE_SLE_15_SP1/ SysTray-X
sudo zypper in systray-x
```
### xUbuntu
#### 19.10
```bash
wget -q https://download.opensuse.org/repositories/home:/Ximi1970:/Mozilla:/Add-ons/xUbuntu_19.10/Release.key
sudo apt-key add Release.key
sudo bash -c "echo 'deb https://download.opensuse.org/repositories/home:/Ximi1970:/Mozilla:/Add-ons/xUbuntu_19.10 ./" > /etc/apt/source.list.d/systray-x.list'```
sudo apt update
sudo apt install systray-x
```
#### 18.04 LTS
```bash
wget -q https://download.opensuse.org/repositories/home:/Ximi1970:/Mozilla:/Add-ons/xUbuntu_18.04/Release.key
sudo apt-key add Release.key
sudo bash -c 'echo "deb https://download.opensuse.org/repositories/home:/Ximi1970:/Mozilla:/Add-ons/xUbuntu_18.04 ./" > /etc/apt/source.list.d/systray-x.list'```
sudo apt update
sudo apt install systray-x
```
## Binaries (User)
User installable package.
No root credentials required.
Download the installer here:
[Companion installer](https://github.com/Ximi1970/systray-x/releases)
And install the add-on using the Thunderbird Add-on / Extensions store.
## Building
@@ -53,6 +118,14 @@ Clone the repository using TortoiseGit:
...
### Remarks
Branches:
master : Should be stable and working for all systems
develop : Working but maybe not for all systems
feature-xxx : Experimental
## Contributers
Luigi Baldoni \<aloisio@gmx.com\> : Initial setup of the OpenSuSE Build Service rpm package.

View File

@@ -1,5 +1,20 @@
#<script>
Installers
Bash:
https://www.matteomattei.com/create-self-contained-installer-in-bash-that-extracts-archives-and-perform-actitions/
Windows:
The good old Nullsoft:
https://sourceforge.net/projects/nsis/
Windows
=========================================

View File

@@ -46,6 +46,7 @@ PreferencesDialog::PreferencesDialog( SysTrayXLink *link, Preferences *pref, QWi
*/
connect( m_ui->chooseCustomButton, &QPushButton::clicked, this, &PreferencesDialog::slotFileSelect );
connect( m_ui->buttonBox, &QDialogButtonBox::accepted, this, &PreferencesDialog::slotAccept );
connect( m_ui->buttonBox, &QDialogButtonBox::rejected, this, &PreferencesDialog::slotReject );
}
@@ -148,9 +149,23 @@ void PreferencesDialog::slotAccept()
m_pref->setAppPrefChanged( false );
/*
* Tell the base
* Close it
*/
QDialog::accept();
// QDialog::accept();
hide();
}
/*
* Handle the accept signal
*/
void PreferencesDialog::slotReject()
{
/*
* Close it
*/
// QDialog::reject();
hide();
}

View File

@@ -87,46 +87,51 @@ class PreferencesDialog : public QDialog
/**
* @brief signalUpdateSysTray. Signal to update the system tray icon.
*/
void signalUpdateSysTrayIcon();
void signalUpdateSysTrayIcon();
public slots:
/**
* @brief slotDebugChange. Slot for handling debug change signals.
*/
void slotDebugChange();
void slotDebugChange();
/**
* @brief slotHideOnMinimizeChange. Slot for handling hide on minimize change signals.
*/
void slotHideOnMinimizeChange();
void slotHideOnMinimizeChange();
/**
* @brief slotStartMinimizedChange. Slot for handling start minimized change signals.
*/
void slotStartMinimizedChange();
void slotStartMinimizedChange();
/**
* @brief slotIconTypeChange. Slot for handling icon type change signals.
*/
void slotIconTypeChange();
void slotIconTypeChange();
/**
* @brief slotIconDataChange. Slot for handling icon data change signals.
*/
void slotIconDataChange();
void slotIconDataChange();
private slots:
/**
* @brief slotAccept. Store the preferences on the accept signal.
*/
void slotAccept();
void slotAccept();
/**
* @brief slotReject. Store the preferences on the accept signal.
*/
void slotReject();
/**
* @brief slotFileSelect. Handle the choose custom button click.
*/
void slotFileSelect();
void slotFileSelect();
private:

View File

@@ -40,6 +40,27 @@ qint64 WindowCtrlUnix::getPpid()
}
/*
* Is the pid from thunderbird
*/
bool WindowCtrlUnix::isThunderbird( qint64 pid )
{
return getProcessName( pid ).contains( "thunderbird", Qt::CaseInsensitive );
}
/*
* Get the process name
*/
QString WindowCtrlUnix::getProcessName( qint64 pid )
{
QString process_name = QString( "/proc/%1/exe" ).arg( pid );
QFileInfo process( process_name );
return process.canonicalFilePath();
}
/*
* Find window(s) by title
*/
@@ -237,6 +258,11 @@ QList< quint64 > WindowCtrlUnix::getWinIds()
*/
void WindowCtrlUnix::minimizeWindow( quint64 window, bool hide )
{
if( !isThunderbird( getPpid() ) )
{
return;
}
Window win = static_cast<Window>( window );
if( hide )
@@ -254,6 +280,11 @@ void WindowCtrlUnix::minimizeWindow( quint64 window, bool hide )
*/
void WindowCtrlUnix::normalizeWindow( quint64 window )
{
if( !isThunderbird( getPpid() ) )
{
return;
}
Window win = static_cast<Window>( window );
hideWindow( win, false );
@@ -278,6 +309,11 @@ void WindowCtrlUnix::normalizeWindow( quint64 window )
*/
void WindowCtrlUnix::hideWindow( quint64 window, bool set )
{
if( !isThunderbird( getPpid() ) )
{
return;
}
Window win = static_cast<Window>( window );
char prop_name[] = "_NET_WM_STATE";
@@ -360,6 +396,11 @@ void WindowCtrlUnix::hideWindow( quint64 window, bool set )
*/
void WindowCtrlUnix::deleteWindow( quint64 window )
{
if( !isThunderbird( getPpid() ) )
{
return;
}
Window win = static_cast<Window>( window );
Atom prop = XInternAtom( m_display, "WM_PROTOCOLS", True );

View File

@@ -17,6 +17,7 @@
* Qt includes
*/
#include <QObject>
#include <QFileInfo>
/*
* Predefines
@@ -121,6 +122,24 @@ class WindowCtrlUnix : public QObject
*/
qint64 getPpid();
/**
* @brief isThunderbird. Is this a thunderbird pid.
*
* @param pid The process Id to check.
*
* @return True if this is thunderbird.
*/
bool isThunderbird( qint64 pid );
/**
* @brief getProcessName. Get the name of the proces by pid.
*
* @param pid The process Id.
*
* @return The process name.
*/
QString getProcessName( qint64 pid );
/**
* @brief findWindow. Find window by (sub)title.
*

View File

@@ -5,13 +5,15 @@
/*
* System includes
*/
#include <tlhelp32.h>
#include <TlHelp32.h>
#include <Psapi.h>
#include <CommCtrl.h>
/*
* Qt includes
*/
#include <QCoreApplication>
#include <QString>
/*
* Statics
@@ -64,6 +66,28 @@ qint64 WindowCtrlWin::getPpid()
}
/*
* Is the pid from thunderbird
*/
bool WindowCtrlWin::isThunderbird( qint64 pid )
{
return getProcessName( pid ).contains( "thunderbird", Qt::CaseInsensitive );
}
/*
* Get the process name
*/
QString WindowCtrlWin::getProcessName( qint64 pid )
{
HANDLE proc = OpenProcess( PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, false, pid );
char name[ 256 ];
GetModuleBaseNameA( proc, NULL, name, 256);
return QString( name );
}
/*
* Find the window by title
*/
@@ -198,6 +222,11 @@ QList< quint64 > WindowCtrlWin::getWinIds()
*/
void WindowCtrlWin::minimizeWindow( quint64 window, bool hide )
{
if( !isThunderbird( getPpid() ) )
{
return;
}
ShowWindow( (HWND)window, SW_MINIMIZE );
if( hide )
@@ -212,6 +241,11 @@ void WindowCtrlWin::minimizeWindow( quint64 window, bool hide )
*/
void WindowCtrlWin::normalizeWindow( quint64 window )
{
if( !isThunderbird( getPpid() ) )
{
return;
}
ShowWindow( (HWND)window, SW_RESTORE );
SetForegroundWindow( (HWND)window );
}
@@ -222,6 +256,11 @@ void WindowCtrlWin::normalizeWindow( quint64 window )
*/
void WindowCtrlWin::hideWindow( quint64 window, bool state )
{
if( !isThunderbird( getPpid() ) )
{
return;
}
if( state )
{
hideWindow( (HWND)window );
@@ -249,6 +288,11 @@ void WindowCtrlWin::hideWindow( HWND hwnd )
*/
void WindowCtrlWin::deleteWindow( quint64 window )
{
if( !isThunderbird( getPpid() ) )
{
return;
}
SendMessageA( (HWND)window, WM_CLOSE, 0, 0 );
}

View File

@@ -45,6 +45,24 @@ class WindowCtrlWin : public QObject
*/
qint64 getPpid();
/**
* @brief isThunderbird. Is this a thunderbird pid.
*
* @param pid The process Id to check.
*
* @return True if this is thunderbird.
*/
bool isThunderbird( qint64 pid );
/**
* @brief getProcessName. Get the name of the proces by pid.
*
* @param pid The process Id.
*
* @return The process name.
*/
QString getProcessName( qint64 pid );
/**
* @brief findWindow. Find window by title.
*

51
app/build.bat Normal file
View File

@@ -0,0 +1,51 @@
@echo off
if "%1" == "" (
goto :usage
)
if "%2" == "" (
goto :usage
)
set ARCH=
set SPEC=
set WIN=
if /I "%1"=="x86" (
set ARCH=x86
set WIN=win32
set SPEC=msvc2017
)
if /I "%1"=="x86_64" (
set ARCH=x86_amd64
set WIN=win64
set SPEC=msvc2017_64
)
if "%ARCH%" == "" (
goto :usage
)
set QT_VER=
if /I "%2"=="5.14.1" (
set QT_VER=5.14.1
)
if "%QT_VER%" == "" (
goto :usage
)
@REM Setup Visual Studio Express 2017
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\WDExpress\VC\Auxiliary\Build\vcvarsall.bat" %ARCH%
@REM Run qmake for VS2017
C:\Qt\%QT_VER%\%SPEC%\bin\qmake ..\SysTray-X\SysTray-X.pro -spec win32-msvc
nmake
xcopy /Q /Y release\SysTray-X.exe ..\dist\%WIN%\
C:\Qt\%QT_VER%\%SPEC%\bin\windeployqt.exe ..\dist\%WIN%\SysTray-X.exe
goto :end
:usage
echo Usage: build.bat ^< x86 ^| x86_64 ^> ^< Qt version ^>
:end

156
create_linux_installers.sh Executable file
View File

@@ -0,0 +1,156 @@
#!/bin/bash
VERSION=`git describe --long | sed "s/-.*//"`
OBS_BASE="https://download.opensuse.org/repositories/home:/Ximi1970:/Mozilla:/Add-ons"
OBS_PACKAGE="systray-x"
OBS_RPM_ARCHS="openSUSE_Leap_15.1/x86_64 "
OBS_RPM_ARCHS="openSUSE_Leap_15.2/x86_64 "
OBS_RPM_ARCHS+="openSUSE_Tumbleweed/i586 "
OBS_RPM_ARCHS+="openSUSE_Tumbleweed/x86_64 "
OBS_RPM_ARCHS+="SLE_15/x86_64 "
OBS_RPM_ARCHS+="SLE_15_SP1/x86_64 "
OBS_DEB_ARCHS="xUbuntu_18.04/i386 "
OBS_DEB_ARCHS+="xUbuntu_18.04/amd64 "
OBS_DEB_ARCHS+="xUbuntu_19.04/amd64 "
OBS_DEB_ARCHS+="xUbuntu_19.10/amd64 "
mkdir -p bin
pushd bin > /dev/null 2>&1
#
# Create bash installers for RPM based distributions
#
for rpmdir in $OBS_RPM_ARCHS ; do
#
# Get base name
#
BASE_NAME=${rpmdir//'/'/$'-'}
PACKAGE_NAME=SysTray-X-$VERSION-$BASE_NAME
rm -rf $PACKAGE_NAME
mkdir -p $PACKAGE_NAME
pushd $PACKAGE_NAME > /dev/null 2>&1
#
# Get index.html
#
wget -q "$OBS_BASE/$rpmdir/"
#
# Find rpm
#
RPM_FILE=`grep ">systray.*<" index.html | sed -e "s/.*>\(systray-x.*rpm\)<.*/\1/"`
#
# Get rpm
#
wget -q "$OBS_BASE/$rpmdir/$RPM_FILE"
#
# Extract
#
rpm2cpio $RPM_FILE | cpio -i --to-stdout ./usr/bin/SysTray-X > SysTray-X 2>/dev/null
chmod 755 SysTray-X
#
# Get JSON
#
cp -f ../../app/config/linux/SysTray_X.json.template SysTray_X.json.template
#
# Cleanup
#
rm -f index.html
rm -f $RPM_FILE
tar cJf ../$PACKAGE_NAME.tar.xz .
popd > /dev/null 2>&1
#
# Create installer
#
cp -f ../dist/install.sh SysTray-X-$VERSION-$BASE_NAME-install.sh
cat $PACKAGE_NAME.tar.xz >> SysTray-X-$VERSION-$BASE_NAME-install.sh
chmod 755 SysTray-X-$VERSION-$BASE_NAME-install.sh
#
# Cleanup
#
rm -rf $PACKAGE_NAME
rm -f $PACKAGE_NAME.tar.xz
done
#
# Create bash installers for DEB based distributions
#
for debdir in $OBS_DEB_ARCHS ; do
#
# Get base name
#
BASE_NAME=${debdir//'/'/$'-'}
PACKAGE_NAME=SysTray-X-$VERSION-$BASE_NAME
rm -rf $PACKAGE_NAME
mkdir -p $PACKAGE_NAME
pushd $PACKAGE_NAME > /dev/null 2>&1
#
# Get index.html
#
wget -q "$OBS_BASE/$debdir/"
#
# Find deb
#
DEB_FILE=`grep ">systray.*\.deb<" index.html | sed -e "s/.*>\(systray-x.*deb\)<.*/\1/"`
#
# Get deb
#
wget -q "$OBS_BASE/$debdir/$DEB_FILE"
#
# Extract
#
dpkg --fsys-tarfile $DEB_FILE | tar xOf - ./usr/bin/SysTray-X > SysTray-X
chmod 755 SysTray-X
#
# Get JSON
#
cp -f ../../app/config/linux/SysTray_X.json.template SysTray_X.json.template
#
# Cleanup
#
rm -f index.html
rm -f $DEB_FILE
tar cJf ../$PACKAGE_NAME.tar.xz .
popd > /dev/null 2>&1
#
# Create installer
#
cp -f ../dist/install.sh SysTray-X-$VERSION-$BASE_NAME-install.sh
cat $PACKAGE_NAME.tar.xz >> SysTray-X-$VERSION-$BASE_NAME-install.sh
chmod 755 SysTray-X-$VERSION-$BASE_NAME-install.sh
#
# Cleanup
#
rm -rf $PACKAGE_NAME
rm -f $PACKAGE_NAME.tar.xz
done
popd > /dev/null 2>&1

View File

@@ -16,5 +16,3 @@ Description: SysTray-X is a system tray extension for Thunderbird 68+.
* show / hide Thunderbird (minimize)
* minimizing hides to tray
* minimize on startup
* to be implemented: start a new mail
* to be implemented: open the last used account

View File

@@ -53,7 +53,7 @@ install: build
cp -f SysTray_X.json /usr/src/packages/BUILD/debian/systray-x/usr/lib/mozilla/native-messaging-hosts/SysTray_X.json
mkdir -p /usr/src/packages/BUILD/debian/systray-x/usr/lib/thunderbird-addons/extensions
cp -f systray-x.xpi /usr/src/packages/BUILD/debian/systray-x/usr/lib/thunderbird-addons/extensions/systray-x@Ximi1970.xpi
cp -f systray-x@Ximi1970.xpi /usr/src/packages/BUILD/debian/systray-x/usr/lib/thunderbird-addons/extensions/systray-x@Ximi1970.xpi
# --- end custom part for installing
# Build architecture-independent files here.

65
dist/install.sh vendored Executable file
View File

@@ -0,0 +1,65 @@
#!/bin/bash
INSTALL_HOME=`echo ~`
if [ "$1" == "-h" ] ; then
echo
echo "Usage: $0 [abs-install-path]"
echo
echo " Default install path: $INSTALL_HOME/.mozilla/native-messaging-hosts"
echo
exit 0
fi
if [ -n "$1" ] ; then
DESTINATION="$1"
else
DESTINATION="$INSTALL_HOME/.mozilla/native-messaging-hosts"
fi
#
# Tell the user what we are going to do
#
echo
echo "Installing SysTray-X companion app to:"
echo "$DESTINATION"
echo
read -n 1 -s -r -p "Press any key to continue, Ctrl-C to cancel"
echo
#
# Install
#
echo "Installing SysTray-X companion app..."
#
# Create destination
#
mkdir -p ${DESTINATION}
#
# Find __ARCHIVE__ maker, read archive content and decompress it
#
ARCHIVE=$(awk '/^__ARCHIVE__/ {print NR + 1; exit 0; }' "${0}")
tail -n+${ARCHIVE} "${0}" | tar xpJ -C ${DESTINATION}
#
# Set the config
#
INSTALL_HOME=`echo ~`
sed -i "s?SYSTRAY_X_PATH?${DESTINATION}/SysTray-X?" ${DESTINATION}/SysTray_X.json.template
mv -f ${DESTINATION}/SysTray_X.json.template ${DESTINATION}/SysTray_X.json
#
# Done
#
echo ""
echo "Companian app installation complete."
echo "App en JSON config have been installed in: $DESTINATION"
echo ""
echo "Do not forget to install the Thunderbird SysTray-X Add-on"
echo "using the standard Thunderbird Add-ons / Extensions store !"
echo ""
exit 0
__ARCHIVE__

12
dist/rpm/_service vendored
View File

@@ -2,9 +2,15 @@
<service name="obs_scm">
<param name="url">https://github.com/Ximi1970/systray-x.git</param>
<param name="scm">git</param>
<param name="revision">develop</param>
<param name="versionformat">0~git%cd.%h</param>
<param name="changesgenerate">enable</param>
<param name="revision">0.1.1</param>
<param name="versionformat">0.1.1</param>
<param name="extract">dist/rpm/systray-x.changes</param>
<param name="extract">dist/rpm/systray-x.spec</param>
<param name="extract">dist/deb/debian.changelog</param>
<param name="extract">dist/deb/debian.compat</param>
<param name="extract">dist/deb/debian.control</param>
<param name="extract">dist/deb/debian.rules</param>
<param name="extract">dist/deb/systray-x.dsc</param>
</service>
<service mode="buildtime" name="tar" />
<service mode="buildtime" name="recompress">

View File

@@ -41,25 +41,26 @@ The add-on and system tray application can do:
* custom new mail icon
* display number of unread mails
* show / hide Thunderbird (minimize)
* to be implemented: remove from task bar when minimized
* to be implemented: start a new mail
* to be implemented: open the last used account
* minimizing hides to tray
* minimize on startup
%prep
%autosetup -p1
%build
make %{?_smp_mflags}
sed < app/config/linux/SysTray_X.json.template -e 's|SYSTRAY_X_PATH|%{_bindir}/SysTray-X|' > SysTray_X.json
%install
_systx_dir=%{buildroot}%{_libdir}/mozilla/extensions/\{3550f703-e582-4d05-9a08-453d09bdfdc6\}/systray-x@Ximi1970
install -Dm0755 SysTray-X %{buildroot}/%{_bindir}/SysTray-X
mkdir -pv $_systx_dir
unzip -d $_systx_dir systray-x.xpi
unzip -d $_systx_dir systray-x@Ximi1970.xpi
install -Dm0644 SysTray_X.json %{buildroot}%{_libdir}/mozilla/native-messaging-hosts/SysTray_X.json
%files
%license LICENSE
%doc README.md
%license LICENSE
%doc README.md systray-x@Ximi1970.xpi
%{_bindir}/SysTray-X
%{_libdir}/mozilla

10
update_version.sh Executable file
View File

@@ -0,0 +1,10 @@
#!/bin/bash
VERSION=$1
SERVICE_FILE="./dist/rpm/_service"
sed -i -e "s?\(^.*\"revision\">\).*\(</param>\)?\1$VERSION\2?" $SERVICE_FILE
sed -i -e "s?\(^.*\"versionformat\">\).*\(</param>\)?\1$VERSION\2?" $SERVICE_FILE
MANIFEST_FILE="./webext/manifest.json"
sed -i -e "s?\(^.*\"version\": \"\).*\(\",\)?\1$VERSION\2?" $MANIFEST_FILE

View File

@@ -2,7 +2,7 @@
"manifest_version": 2,
"name": "__MSG_extension_name__",
"description": "__MSG_extension_description__",
"version": "0.1",
"version": "0.1.1",
"author": "Maxime Rijnders",
"homepage_url": "https://github.com/Ximi1970/systray-x",