forked from blue/squawk
Compare commits
15 Commits
encryption
...
master
Author | SHA1 | Date | |
---|---|---|---|
a04693e39d | |||
3cce057545 | |||
9a44ae1fa5 | |||
85ff6c25ba | |||
3cc7db8eff | |||
|
ff9a591d6d | ||
8e3f10caff | |||
8bfe88929f | |||
9927bdc38b | |||
|
8083859541 | ||
|
030c374139 | ||
|
2c61b82924 | ||
fb843a1346 | |||
8d82d340a4 | |||
acd60eaba2 |
45
.gitea/workflows/release.yml
Normal file
45
.gitea/workflows/release.yml
Normal file
@ -0,0 +1,45 @@
|
||||
name: Squawk Release workflow
|
||||
run-name: ${{ gitea.actor }} is running Squawk Release workflow on release ${{ gitea.event.release.tag_name }}
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
jobs:
|
||||
Archlinux:
|
||||
runs-on: archlinux
|
||||
steps:
|
||||
- name: Download the release tarball
|
||||
run: curl -sL ${{ gitea.server_url }}/${{ gitea.repository }}/archive/${{ gitea.event.release.tag_name }}.tar.gz --output tarball.tar.gz
|
||||
|
||||
- name: Calculate SHA256 for the tarball
|
||||
run: echo "tbSum=$(sha256sum tarball.tar.gz | cut -d ' ' -f 1)" >> $GITHUB_ENV
|
||||
|
||||
- name: Unarchive tarball
|
||||
run: tar -xvzf tarball.tar.gz
|
||||
|
||||
- name: Clone the AUR repository
|
||||
run: |
|
||||
echo "${{ secrets.DEPLOY_TO_AUR_PRIVATE_KEY }}" > key
|
||||
chmod 600 key
|
||||
GIT_SSH_COMMAND="ssh -i key -o 'IdentitiesOnly yes' -o 'StrictHostKeyChecking no'" git clone ssh://aur@aur.archlinux.org/squawk.git aur
|
||||
chmod 777 -R aur
|
||||
cd aur
|
||||
git config user.name ${{ secrets.DEPLOY_TO_AUR_USER_NAME }}
|
||||
git config user.email ${{ secrets.DEPLOY_TO_AUR_EMAIL }}
|
||||
|
||||
|
||||
- name: Copy PKGBUILD to the directory
|
||||
run: cp squawk/packaging/Archlinux/PKGBUILD aur/
|
||||
|
||||
- name: Put SHA256 sum to PKGBUILD file, and generate .SRCINFO
|
||||
working-directory: aur
|
||||
run: |
|
||||
sed -i "/sha256sums=/c\sha256sums=('${{ env.tbSum }}')" PKGBUILD
|
||||
sudo -u build makepkg --printsrcinfo > .SRCINFO
|
||||
|
||||
- name: Commit package to aur
|
||||
working-directory: aur
|
||||
run: |
|
||||
git add PKGBUILD .SRCINFO
|
||||
git commit -m "${{ gitea.event.release.body//\"/\\\" }}"
|
||||
GIT_SSH_COMMAND="ssh -i ../key -o 'IdentitiesOnly yes' -o 'StrictHostKeyChecking no'" git push
|
@ -1,9 +1,10 @@
|
||||
# Changelog
|
||||
|
||||
## Squawk 0.2.3 (UNRELEASED)
|
||||
## Squawk 0.2.3 (February 04, 2024)
|
||||
### Bug fixes
|
||||
- "Add contact" and "Join conference" menu are enabled once again (pavavno)!
|
||||
- availability is now read from the same section of config file it was stored
|
||||
- automatic avatars (if a contact doesn't have one) get generated once again
|
||||
|
||||
### Improvements
|
||||
- deactivated accounts now don't appear in combobox of "Add contact" and "Join conference" dialogues
|
||||
@ -11,11 +12,12 @@
|
||||
- settings file on the disk is not rewritten every roster element expansion or collapse
|
||||
- removed unnecessary own vcard request at sturtup (used to do it to discover my own avatar)
|
||||
- vcard window now is Info system and it can display more information
|
||||
- reduced vcard request spam in MUCs
|
||||
|
||||
### New features
|
||||
- now you can enable tray icon from settings!
|
||||
- there is a job queue now, this allowes to spread a bit the spam on the server at connection time
|
||||
- squawk now querries clients of it's peers, you can see what programs other people use
|
||||
- squawk now queries clients of it's peers, you can see what programs other people use
|
||||
|
||||
## Squawk 0.2.2 (May 05, 2022)
|
||||
### Bug fixes
|
||||
|
@ -1,9 +1,10 @@
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
project(squawk VERSION 0.2.3 LANGUAGES CXX)
|
||||
|
||||
cmake_policy(SET CMP0076 NEW)
|
||||
cmake_policy(SET CMP0077 NEW)
|
||||
cmake_policy(SET CMP0079 NEW)
|
||||
cmake_policy(SET CMP0167 NEW)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
|
||||
set(QT_VERSION_MAJOR 5)
|
||||
@ -33,7 +34,8 @@ option(SYSTEM_LMDBAL "Use system lmdbal lib" ON)
|
||||
option(WITH_KWALLET "Build KWallet support module" ON)
|
||||
option(WITH_KIO "Build KIO support module" ON)
|
||||
option(WITH_KCONFIG "Build KConfig support module" ON)
|
||||
option(WITH_OMEMO "Build OMEMO support module" ON)
|
||||
option(WITH_OMEMO "Build OMEMO support module" OFF) #it should be off by default untill I sort the problems out
|
||||
option(WITH_SIMPLE_CRYPT "Builds with SimpleCrypt to obfuscate password" ON)
|
||||
|
||||
# Dependencies
|
||||
## Qt
|
||||
@ -175,13 +177,18 @@ target_link_libraries(squawk
|
||||
Qt${QT_VERSION_MAJOR}::Xml
|
||||
LMDBAL::LMDBAL
|
||||
QXmpp::QXmpp
|
||||
simpleCrypt
|
||||
)
|
||||
|
||||
if (WITH_OMEMO)
|
||||
target_link_libraries(squawk PRIVATE QXmpp::Omemo)
|
||||
endif ()
|
||||
|
||||
if (WITH_SIMPLE_CRYPT)
|
||||
target_compile_definitions(squawk PRIVATE WITH_SIMPLE_CRYPT)
|
||||
add_subdirectory(external/simpleCrypt)
|
||||
target_link_libraries(squawk PRIVATE simpleCrypt)
|
||||
endif ()
|
||||
|
||||
## Link thread libraries on Linux
|
||||
if(UNIX AND NOT APPLE)
|
||||
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||
@ -211,9 +218,13 @@ if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
target_compile_options(squawk PRIVATE ${COMPILE_OPTIONS})
|
||||
endif(CMAKE_COMPILER_IS_GNUCXX)
|
||||
|
||||
# I am not really sure about this solution
|
||||
# This should enable plugins to be found in path like /usr/lib/squawk instead of just /usr/lib
|
||||
set(PLUGIN_PATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/squawk")
|
||||
add_compile_definitions(PLUGIN_PATH="${PLUGIN_PATH}")
|
||||
|
||||
add_subdirectory(main)
|
||||
add_subdirectory(core)
|
||||
add_subdirectory(external/simpleCrypt)
|
||||
add_subdirectory(packaging)
|
||||
add_subdirectory(plugins)
|
||||
add_subdirectory(resources)
|
||||
|
75
README.md
75
README.md
@ -4,14 +4,14 @@
|
||||
[![AUR version](https://img.shields.io/aur/version/squawk?style=flat-square)](https://aur.archlinux.org/packages/squawk/)
|
||||
[![Liberapay patrons](https://img.shields.io/liberapay/patrons/macaw.me?logo=liberapay&style=flat-square)](https://liberapay.com/macaw.me)
|
||||
|
||||
![Squawk screenshot](https://macaw.me/images/squawk/0.2.2.png)
|
||||
![Squawk screenshot](https://macaw.me/projects/squawk/0.2.2.png)
|
||||
|
||||
### Prerequisites
|
||||
|
||||
- QT 5.12 *(lower versions might work but it wasn't tested)*
|
||||
- CMake 3.4 or higher
|
||||
- qxmpp 1.1.0 or higher
|
||||
- LMDBAL (my own [library](https://git.macaw.me/blue/lmdbal) around lmdb)
|
||||
- LMDBAL (my own [library](https://git.macaw.me/blue/lmdbal) for lmdb)
|
||||
- KDE Frameworks: kwallet (optional)
|
||||
- KDE Frameworks: KIO (optional)
|
||||
- KDE Frameworks: KConfig (optional)
|
||||
@ -33,14 +33,49 @@ $ pacaur -S squawk
|
||||
|
||||
### Building
|
||||
|
||||
You can also clone the repo and build it from source
|
||||
You can also the repo and build it from source
|
||||
|
||||
Squawk requires Qt with SSL enabled. It uses CMake as build system.
|
||||
|
||||
Please check the prerequisites and install them before installation.
|
||||
|
||||
---
|
||||
|
||||
There are several ways to build Squawk. The one you need depends on whether you have `qxmpp` and `lmdbal` installed in your system.
|
||||
|
||||
#### Building with system dependencies
|
||||
|
||||
This is the easiest way but it requires you to have `qxmpp` and `lmdbal` installed as system packages. Here is what you do:
|
||||
|
||||
```
|
||||
$ git clone https://git.macaw.me/blue/squawk
|
||||
$ cd squawk
|
||||
$ mkdir build
|
||||
$ cd build
|
||||
$ cmake ..
|
||||
$ cmake --build .
|
||||
```
|
||||
|
||||
#### Building with bundled qxmpp
|
||||
|
||||
If you don't have any of `qxmpp` or `lmdbal` (or both) installed the process is abit mor complicated.
|
||||
On the configuration stage you need to enable one or both entries in the square brackets, depending on what package your system lacks.
|
||||
|
||||
Here is what you do
|
||||
|
||||
```
|
||||
$ git clone --recurse-submodules https://git.macaw.me/blue/squawk
|
||||
$ cd squawk
|
||||
$ mkdir build
|
||||
$ cd build
|
||||
$ cmake .. [-D SYSTEM_QXMPP=False] [-D SYSTEM_LMDBAL=False]
|
||||
$ cmake --build .
|
||||
```
|
||||
|
||||
#### For Windows (Mingw-w64) build
|
||||
|
||||
**Building for windows is not mainteined, but was possible in the past, you can try, but it probably won't work**
|
||||
|
||||
You need Qt for mingw64 (MinGW 64-bit) platform when installing Qt.
|
||||
|
||||
The best way to acquire library `lmdb` and `boost` is through Msys2.
|
||||
@ -49,54 +84,30 @@ First install Msys2, and then install `mingw-w64-x86_64-lmdb` and `mingw-w64-x86
|
||||
|
||||
Then you need to provide the cmake cache entry when calling cmake for configuration:
|
||||
|
||||
```
|
||||
cmake .. -D LMDB_ROOT_DIR:PATH=<Msys2 Mingw64 Root Directory> -D BOOST_ROOT:PATH=<Msys2 Mingw64 Root Directory>
|
||||
```
|
||||
|
||||
`<Msys2 Mingw64 Root Directory>`: e.g. `C:/msys64/mingw64`.
|
||||
|
||||
---
|
||||
|
||||
There are two ways to build, it depends whether you have qxmpp installed in your system
|
||||
|
||||
#### Building with system qxmpp
|
||||
|
||||
Here is what you do
|
||||
|
||||
```
|
||||
$ git clone https://git.macaw.me/blue/squawk
|
||||
$ cd squawk
|
||||
$ mkdir build
|
||||
$ cd build
|
||||
$ cmake .. [-D LMDB_ROOT_DIR:PATH=...] [-D BOOST_ROOT:PATH=...]
|
||||
$ cmake --build .
|
||||
```
|
||||
|
||||
#### Building with bundled qxmpp
|
||||
|
||||
Here is what you do
|
||||
|
||||
```
|
||||
$ git clone --recurse-submodules https://git.macaw.me/blue/squawk
|
||||
$ cd squawk
|
||||
$ mkdir build
|
||||
$ cd build
|
||||
$ cmake .. -D SYSTEM_QXMPP=False [-D LMDB_ROOT_DIR:PATH=...] [-D BOOST_ROOT:PATH=...]
|
||||
$ cmake .. -D SYSTEM_QXMPP=False -D SYSTEM_LMDBAL=False -D LMDB_ROOT_DIR:PATH=<Msys2 Mingw64 Root Directory> -D BOOST_ROOT:PATH=<Msys2 Mingw64 Root Directory>
|
||||
$ cmake --build .
|
||||
```
|
||||
|
||||
You can always refer to `appveyor.yml` to see how AppVeyor build squawk.
|
||||
You can always refer to `appveyor.yml` to see how AppVeyor build squawk for windows.
|
||||
|
||||
### List of keys
|
||||
|
||||
Here is the list of keys you can pass to configuration phase of `cmake ..`.
|
||||
Here is the list of keys you can pass to configuration phase of `cmake ..`:
|
||||
|
||||
- `CMAKE_BUILD_TYPE` - `Debug` just builds showing all warnings, `Release` builds with no warnings and applies optimizations (default is `Debug`)
|
||||
- `SYSTEM_QXMPP` - `True` tries to link against `qxmpp` installed in the system, `False` builds bundled `qxmpp` library (default is `True`)
|
||||
- `SYSTEM_LMDBAL` - `True` tries to link against `LMDABL` installed in the system, `False` builds bundled `LMDBAL` library (default is `True`)
|
||||
- `WITH_KWALLET` - `True` builds the `KWallet` capability module if `KWallet` is installed and if not goes to `False`. `False` disables `KWallet` support (default is `True`)
|
||||
- `WITH_KIO` - `True` builds the `KIO` capability module if `KIO` is installed and if not goes to `False`. `False` disables `KIO` support (default is `True`)
|
||||
- `WITH_KCONFIG` - `True` builds the `KConfig` and `KConfigWidgets` capability module if such packages are installed and if not goes to `False`. `False` disables `KConfig` and `KConfigWidgets` support (default is `True`)
|
||||
- `WITH_OMEMO` - `True` builds the OMEMO encryption, requires `qxmpp` of version >= 1.5.0 built with OMEMO support. `False` disables OMEMO support (default is `True`)
|
||||
- `WITH_OMEMO` - `True` builds the OMEMO encryption, requires `qxmpp` of version >= 1.5.0 built with OMEMO support. `False` disables OMEMO support (default is `False`)
|
||||
|
||||
## License
|
||||
|
||||
|
@ -60,12 +60,14 @@
|
||||
#include "handlers/vcardhandler.h"
|
||||
#include "handlers/discoveryhandler.h"
|
||||
|
||||
#if (QXMPP_VERSION) >= QT_VERSION_CHECK(1, 5, 0)
|
||||
#include <QXmppTrustManager.h>
|
||||
#ifdef WITH_OMEMO
|
||||
#include <QXmppOmemoManager.h>
|
||||
#include <QXmppTrustManager.h>
|
||||
#include "handlers/trusthandler.h"
|
||||
#include "handlers/omemohandler.h"
|
||||
#endif
|
||||
#include "handlers/trusthandler.h"
|
||||
#endif
|
||||
|
||||
namespace Core {
|
||||
|
||||
|
@ -45,7 +45,10 @@ void Core::DelayManager::Info::receivedVCard(const Shared::VCard& card) {
|
||||
throw 245;
|
||||
|
||||
info = new Shared::VCard(card);
|
||||
|
||||
#ifdef WITH_OMEMO
|
||||
stage = Stage::waitingForBundles;
|
||||
#endif
|
||||
}
|
||||
|
||||
Shared::VCard * Core::DelayManager::Info::claim() {
|
||||
|
@ -242,7 +242,9 @@ void Core::DelayManager::Manager::jobIsCanceled(Job* job, bool wasRunning) {
|
||||
emit gotVCard(jb->jid, Shared::VCard());
|
||||
break;
|
||||
case InfoForUser::Stage::waitingForBundles:
|
||||
#ifdef WITH_OMEMO
|
||||
requestedBundles.erase(jb->jid);
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -356,6 +358,7 @@ void Core::DelayManager::Manager::receivedOwnVCard(const Shared::VCard& card) {
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef WITH_OMEMO
|
||||
void Core::DelayManager::Manager::receivedBundles(const QString& jid, const std::list<Shared::KeyInfo>& keys) {
|
||||
std::map<QString, Job::Id>::const_iterator itr = requestedBundles.find(jid);
|
||||
if (itr == requestedBundles.end()) {
|
||||
@ -397,6 +400,7 @@ void Core::DelayManager::Manager::receivedOwnBundles(const std::list<Shared::Key
|
||||
emit gotOwnInfo(info);
|
||||
jobIsDone(jobId);
|
||||
}
|
||||
#endif
|
||||
|
||||
void Core::DelayManager::Manager::setOwnJid(const QString& jid) {
|
||||
ownJid = jid;
|
||||
|
@ -56,8 +56,11 @@ public slots:
|
||||
signals:
|
||||
void requestVCard(const QString& jid);
|
||||
void requestOwnVCard();
|
||||
|
||||
#ifdef WITH_OMEMO
|
||||
void requestBundles(const QString& jid);
|
||||
void requestOwnBundles();
|
||||
#endif
|
||||
|
||||
void gotVCard(const QString& jid, const Shared::VCard& info);
|
||||
void gotOwnVCard(const Shared::VCard& info);
|
||||
@ -68,8 +71,11 @@ public slots:
|
||||
void disconnected();
|
||||
void receivedOwnVCard(const Shared::VCard& card);
|
||||
void receivedVCard(const QString& jid, const Shared::VCard& card);
|
||||
|
||||
#ifdef WITH_OMEMO
|
||||
void receivedBundles(const QString& jid, const std::list<Shared::KeyInfo>& keys);
|
||||
void receivedOwnBundles(const std::list<Shared::KeyInfo>& keys);
|
||||
#endif
|
||||
|
||||
private:
|
||||
void preScheduleJob(Job* job);
|
||||
|
@ -3,7 +3,6 @@ set(SOURCE_FILES
|
||||
rosterhandler.cpp
|
||||
vcardhandler.cpp
|
||||
discoveryhandler.cpp
|
||||
omemohandler.cpp
|
||||
trusthandler.cpp
|
||||
)
|
||||
|
||||
@ -12,11 +11,12 @@ set(HEADER_FILES
|
||||
rosterhandler.h
|
||||
vcardhandler.h
|
||||
discoveryhandler.h
|
||||
omemohandler.h
|
||||
trusthandler.h
|
||||
)
|
||||
|
||||
target_sources(squawk PRIVATE
|
||||
${SOURCE_FILES}
|
||||
${HEADER_FILES}
|
||||
)
|
||||
if(WITH_OMEMO)
|
||||
list(APPEND SOURCE_FILES omemohandler.cpp)
|
||||
list(APPEND HEADER_FILES omemohandler.h)
|
||||
endif()
|
||||
|
||||
target_sources(squawk PRIVATE ${SOURCE_FILES})
|
||||
|
@ -431,7 +431,7 @@ QMap<QString, QVariant> Core::MessageHandler::getChanges(Shared::Message& data,
|
||||
}
|
||||
|
||||
QXmppMessage Core::MessageHandler::createPacket(const Shared::Message& data, const QDateTime& time, const QString& originalId) const {
|
||||
QXmppMessage msg(acc->getFullJid(), data.getTo(), data.getBody(), data.getThread());
|
||||
QXmppMessage msg(QString(), data.getTo(), data.getBody(), data.getThread());
|
||||
QString id(data.getId());
|
||||
|
||||
if (originalId.size() > 0)
|
||||
|
@ -28,7 +28,8 @@ Core::PSE::KWallet::CreateFolder Core::PSE::KWallet::createFolder = 0;
|
||||
Core::PSE::KWallet::SetFolder Core::PSE::KWallet::setFolder = 0;
|
||||
|
||||
Core::PSE::KWallet::SupportState Core::PSE::KWallet::sState = Core::PSE::KWallet::initial;
|
||||
QLibrary Core::PSE::KWallet::lib("kwalletWrapper");
|
||||
|
||||
QLibrary Core::PSE::KWallet::lib(QString("%1/kwalletWrapper").arg(PLUGIN_PATH));
|
||||
|
||||
Core::PSE::KWallet::KWallet():
|
||||
QObject(),
|
||||
|
@ -1,4 +1,4 @@
|
||||
add_library(kwalletWrapper SHARED kwallet.cpp)
|
||||
target_link_libraries(kwalletWrapper PRIVATE KF5::Wallet)
|
||||
|
||||
install(TARGETS kwalletWrapper LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
install(TARGETS kwalletWrapper LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/squawk)
|
||||
|
@ -22,6 +22,10 @@
|
||||
#include <QDir>
|
||||
#include <QStandardPaths>
|
||||
|
||||
#ifdef WITH_SIMPLE_CRYPT
|
||||
#include "external/simpleCrypt/simplecrypt.h"
|
||||
#endif
|
||||
|
||||
Core::Squawk::Squawk(QObject* parent):
|
||||
QObject(parent),
|
||||
accounts(),
|
||||
@ -29,10 +33,10 @@ Core::Squawk::Squawk(QObject* parent):
|
||||
state(Shared::Availability::offline),
|
||||
network(),
|
||||
isInitialized(false),
|
||||
clientCache(),
|
||||
#ifdef WITH_KWALLET
|
||||
kwallet()
|
||||
kwallet(),
|
||||
#endif
|
||||
clientCache()
|
||||
{
|
||||
connect(&network, &NetworkAccess::loadFileProgress, this, &Squawk::fileProgress);
|
||||
connect(&network, &NetworkAccess::loadFileError, this, &Squawk::fileError);
|
||||
@ -71,7 +75,6 @@ void Core::Squawk::stop() {
|
||||
QSettings settings;
|
||||
settings.beginGroup("core");
|
||||
settings.beginWriteArray("accounts");
|
||||
SimpleCrypt crypto(passwordHash);
|
||||
for (std::deque<Account*>::size_type i = 0; i < accounts.size(); ++i) {
|
||||
settings.setArrayIndex(i);
|
||||
Account* acc = accounts[i];
|
||||
@ -84,7 +87,13 @@ void Core::Squawk::stop() {
|
||||
password = acc->getPassword();
|
||||
break;
|
||||
case Shared::AccountPassword::jammed:
|
||||
password = crypto.encryptToString(acc->getPassword());
|
||||
#ifdef WITH_SIMPLE_CRYPT2
|
||||
password = SimpleCrypt(passwordHash).encryptToString(acc->getPassword());
|
||||
#else
|
||||
qDebug() << "The password for account" << acc->getName() << "is set to be jammed, but Squawk was compiled without SimpleCrypt support";
|
||||
qDebug("Can not encode password, setting this account to always ask password mode");
|
||||
ap = Shared::AccountPassword::alwaysAsk;
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -697,17 +706,24 @@ void Core::Squawk::readSettings() {
|
||||
settings.value("passwordType", static_cast<int>(Shared::AccountPassword::plain)).toInt()
|
||||
);
|
||||
|
||||
QString name = settings.value("name").toString();
|
||||
QString password = settings.value("password", "").toString();
|
||||
if (passwordType == Shared::AccountPassword::jammed) {
|
||||
#ifdef WITH_SIMPLE_CRYPT
|
||||
SimpleCrypt crypto(passwordHash);
|
||||
password = crypto.decryptToString(password);
|
||||
#else
|
||||
qDebug() << "The password for account" << name << "is jammed, but Squawk was compiled without SimpleCrypt support";
|
||||
qDebug("Can not decode password, setting this account to always ask password mode");
|
||||
passwordType = Shared::AccountPassword::alwaysAsk;
|
||||
#endif
|
||||
}
|
||||
|
||||
addAccount(
|
||||
settings.value("login").toString(),
|
||||
settings.value("server").toString(),
|
||||
password,
|
||||
settings.value("name").toString(),
|
||||
name,
|
||||
settings.value("resource").toString(),
|
||||
settings.value("active").toBool(),
|
||||
passwordType
|
||||
|
@ -33,7 +33,6 @@
|
||||
#include "shared/global.h"
|
||||
#include "shared/info.h"
|
||||
#include "shared/clientinfo.h"
|
||||
#include "external/simpleCrypt/simplecrypt.h"
|
||||
|
||||
#include <core/components/clientcache.h>
|
||||
#include <core/components/networkaccess.h>
|
||||
@ -42,10 +41,8 @@
|
||||
#include "passwordStorageEngines/kwallet.h"
|
||||
#endif
|
||||
|
||||
namespace Core
|
||||
{
|
||||
class Squawk : public QObject
|
||||
{
|
||||
namespace Core {
|
||||
class Squawk : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
@ -140,12 +137,13 @@ private:
|
||||
Shared::Availability state;
|
||||
NetworkAccess network;
|
||||
bool isInitialized;
|
||||
ClientCache clientCache;
|
||||
|
||||
#ifdef WITH_KWALLET
|
||||
PSE::KWallet kwallet;
|
||||
#endif
|
||||
|
||||
ClientCache clientCache;
|
||||
|
||||
private slots:
|
||||
void addAccount(
|
||||
const QString& login,
|
||||
|
2
external/simpleCrypt/simplecrypt.cpp
vendored
2
external/simpleCrypt/simplecrypt.cpp
vendored
@ -19,7 +19,7 @@
|
||||
DISCLAIMED. IN NO EVENT SHALL ANDRE SOMERS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR #######; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
2
external/simpleCrypt/simplecrypt.h
vendored
2
external/simpleCrypt/simplecrypt.h
vendored
@ -19,7 +19,7 @@
|
||||
DISCLAIMED. IN NO EVENT SHALL ANDRE SOMERS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR #######; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
@ -245,7 +245,7 @@ void Application::onChangeTray(bool enabled, bool hide) {
|
||||
trayIcon = nullptr;
|
||||
}
|
||||
}
|
||||
} else if (trayIcon == nullptr) {
|
||||
} else if (trayIcon != nullptr) {
|
||||
trayIcon->deleteLater();
|
||||
trayIcon = nullptr;
|
||||
}
|
||||
|
@ -58,6 +58,7 @@ Root::~Root() {
|
||||
delete gui;
|
||||
if (core != nullptr)
|
||||
delete core;
|
||||
|
||||
delete coreThread;
|
||||
}
|
||||
delete global;
|
||||
@ -72,13 +73,13 @@ void Root::initializeTranslation() {
|
||||
bool found = false;
|
||||
for (QString share : shares) {
|
||||
found = currentTranslator.load(QLocale(), QLatin1String("squawk"), ".", share + "/l10n");
|
||||
if (found) {
|
||||
if (found)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
|
||||
if (!found)
|
||||
currentTranslator.load(QLocale(), QLatin1String("squawk"), ".", QCoreApplication::applicationDirPath());
|
||||
}
|
||||
|
||||
|
||||
installTranslator(¤tTranslator);
|
||||
}
|
||||
@ -94,20 +95,18 @@ bool Root::initializeSettings() {
|
||||
QVariant vs = settings.value("style");
|
||||
if (vs.isValid()) {
|
||||
QString style = vs.toString().toLower();
|
||||
if (style != "system") {
|
||||
if (style != "system")
|
||||
Shared::Global::setStyle(style);
|
||||
}
|
||||
}
|
||||
|
||||
if (Shared::Global::supported("colorSchemeTools")) {
|
||||
QVariant vt = settings.value("theme");
|
||||
if (vt.isValid()) {
|
||||
QString theme = vt.toString();
|
||||
if (theme.toLower() != "system") {
|
||||
if (theme.toLower() != "system")
|
||||
Shared::Global::setTheme(theme);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QString path = Shared::downloadsPathCheck();
|
||||
if (path.size() > 0) {
|
||||
|
@ -6,15 +6,15 @@ pkgdesc="An XMPP desktop messenger, written on pure c++ (qt)"
|
||||
arch=('i686' 'x86_64')
|
||||
url="https://git.macaw.me/blue/squawk"
|
||||
license=('GPL3')
|
||||
depends=('hicolor-icon-theme' 'desktop-file-utils' 'lmdbal' 'qxmpp>=1.1.0')
|
||||
depends=('hicolor-icon-theme' 'desktop-file-utils' 'lmdbal' 'qxmpp-qt5')
|
||||
makedepends=('cmake>=3.3' 'imagemagick' 'qt5-tools' 'boost')
|
||||
optdepends=('kwallet: secure password storage (requires rebuild)'
|
||||
'kconfig: system themes support (requires rebuild)'
|
||||
'kconfigwidgets: system themes support (requires rebuild)'
|
||||
'kio: better show in folder action (requires rebuild)')
|
||||
optdepends=('kwallet5: secure password storage (requires rebuild)'
|
||||
'kconfig5: system themes support (requires rebuild)'
|
||||
'kconfigwidgets5: system themes support (requires rebuild)'
|
||||
'kio5: better show in folder action (requires rebuild)')
|
||||
|
||||
source=("$pkgname-$pkgver.tar.gz")
|
||||
sha256sums=('e4fa2174a3ba95159cc3b0bac3f00550c9e0ce971c55334e2662696a4543fc7e')
|
||||
source=("$pkgname-$pkgver.tar.gz::https://git.macaw.me/blue/$pkgname/archive/$pkgver.tar.gz")
|
||||
sha256sums=('SKIP')
|
||||
build() {
|
||||
cd "$srcdir/squawk"
|
||||
cmake . -D CMAKE_INSTALL_PREFIX=/usr -D CMAKE_BUILD_TYPE=Release
|
||||
|
@ -1,3 +1,7 @@
|
||||
configure_file(squawk.desktop squawk.desktop COPYONLY)
|
||||
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/squawk.desktop DESTINATION ${CMAKE_INSTALL_DATADIR}/applications)
|
||||
|
||||
configure_file(macaw.me.squawk.appdata.xml macaw.me.squawk.appdata.xml COPYONLY)
|
||||
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/macaw.me.squawk.appdata.xml DESTINATION ${CMAKE_INSTALL_DATADIR}/metainfo)
|
||||
|
33
packaging/macaw.me.squawk.appdata.xml
Normal file
33
packaging/macaw.me.squawk.appdata.xml
Normal file
@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<component xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:its="http://www.w3.org/2005/11/its" xmlns="https://specifications.freedesktop.org/metainfo/1.0" type="desktop-application">
|
||||
<id>macaw.me.squawk</id>
|
||||
<metadata_license>CC0-1.0</metadata_license>
|
||||
<project_license>GPL-3.0+</project_license>
|
||||
<name>Squawk</name>
|
||||
<summary>Desktop Qt based XMPP messenger</summary>
|
||||
<description>
|
||||
<p>
|
||||
Squawk is a lightweight XMPP desktop messenger.
|
||||
The primary objective of this project is to offer
|
||||
you a fast and user-friendly messaging experience
|
||||
that closely aligns with your system’s style, while
|
||||
also minimizing resource consumption.
|
||||
</p>
|
||||
<p>
|
||||
Squawk is still at a very early stage and might not suit
|
||||
everyone but you are welcome to try it out.
|
||||
</p>
|
||||
</description>
|
||||
<launchable type="desktop-id">macaw.me.squawk.desktop</launchable>
|
||||
<screenshots>
|
||||
<screenshot type="default">
|
||||
<image>https://macaw.me/projects/squawk/0.2.2.png</image>
|
||||
<caption>View XMPP contacts and conversations</caption>
|
||||
</screenshot>
|
||||
</screenshots>
|
||||
<url type="homepage">https://macaw.me/projects/squawk/</url>
|
||||
<provides>
|
||||
<binary>squawk</binary>
|
||||
</provides>
|
||||
<update_contact>blue@macaw.me</update_contact>
|
||||
</component>
|
@ -2,7 +2,7 @@ if (WITH_KIO)
|
||||
add_library(openFileManagerWindowJob SHARED openfilemanagerwindowjob.cpp)
|
||||
target_link_libraries(openFileManagerWindowJob PRIVATE KF5::KIOWidgets)
|
||||
|
||||
install(TARGETS openFileManagerWindowJob LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
install(TARGETS openFileManagerWindowJob LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/squawk)
|
||||
endif ()
|
||||
|
||||
if (WITH_KCONFIG)
|
||||
@ -10,5 +10,5 @@ if (WITH_KCONFIG)
|
||||
target_link_libraries(colorSchemeTools PRIVATE KF5::ConfigCore)
|
||||
target_link_libraries(colorSchemeTools PRIVATE KF5::ConfigWidgets)
|
||||
|
||||
install(TARGETS colorSchemeTools LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
install(TARGETS colorSchemeTools LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/squawk)
|
||||
endif()
|
||||
|
@ -3,11 +3,8 @@ target_sources(squawk PRIVATE resources.qrc)
|
||||
configure_file(images/logo.svg squawk.svg COPYONLY)
|
||||
configure_file(squawk.rc squawk.rc COPYONLY)
|
||||
|
||||
if(WIN32)
|
||||
set(CONVERT_BIN magick convert)
|
||||
else(WIN32)
|
||||
set(CONVERT_BIN convert)
|
||||
endif(WIN32)
|
||||
set(CONVERT_BIN magick)
|
||||
|
||||
execute_process(COMMAND ${CONVERT_BIN} -background none -size 48x48 squawk.svg squawk48.png WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
execute_process(COMMAND ${CONVERT_BIN} -background none -size 64x64 squawk.svg squawk64.png WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
execute_process(COMMAND ${CONVERT_BIN} -background none -size 128x128 squawk.svg squawk128.png WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
@ -22,16 +19,16 @@ endif(WIN32)
|
||||
|
||||
if (APPLE)
|
||||
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/icns.iconset")
|
||||
execute_process(COMMAND convert -background none -size 16x16 squawk.svg icns.iconset/icon_16x16.png WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
execute_process(COMMAND convert -background none -resize !32x32 squawk.svg "icns.iconset/icon_16x16@2x.png" WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
execute_process(COMMAND convert -background none -resize !32x32 squawk.svg "icns.iconset/icon_32x32.png" WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
execute_process(COMMAND convert -background none -resize !64x64 squawk.svg "icns.iconset/icon_32x32@2x.png" WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
execute_process(COMMAND convert -background none -resize !128x128 squawk.svg "icns.iconset/icon_128x128.png" WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
execute_process(COMMAND convert -background none -resize !256x256 squawk.svg "icns.iconset/icon_128x128@2x.png" WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
execute_process(COMMAND convert -background none -resize !256x256 squawk.svg "icns.iconset/icon_256x256.png" WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
execute_process(COMMAND convert -background none -resize !512x512 squawk.svg "icns.iconset/icon_256x256@2x.png" WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
execute_process(COMMAND convert -background none -resize !512x512 squawk.svg "icns.iconset/icon_512x512.png" WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
execute_process(COMMAND convert -background none -resize !1024x1024 squawk.svg "icns.iconset/icon_512x512@2x.png" WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
execute_process(COMMAND ${CONVERT_BIN} -background none -size 16x16 squawk.svg icns.iconset/icon_16x16.png WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
execute_process(COMMAND ${CONVERT_BIN} -background none -resize !32x32 squawk.svg "icns.iconset/icon_16x16@2x.png" WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
execute_process(COMMAND ${CONVERT_BIN} -background none -resize !32x32 squawk.svg "icns.iconset/icon_32x32.png" WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
execute_process(COMMAND ${CONVERT_BIN} -background none -resize !64x64 squawk.svg "icns.iconset/icon_32x32@2x.png" WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
execute_process(COMMAND ${CONVERT_BIN} -background none -resize !128x128 squawk.svg "icns.iconset/icon_128x128.png" WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
execute_process(COMMAND ${CONVERT_BIN} -background none -resize !256x256 squawk.svg "icns.iconset/icon_128x128@2x.png" WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
execute_process(COMMAND ${CONVERT_BIN} -background none -resize !256x256 squawk.svg "icns.iconset/icon_256x256.png" WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
execute_process(COMMAND ${CONVERT_BIN} -background none -resize !512x512 squawk.svg "icns.iconset/icon_256x256@2x.png" WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
execute_process(COMMAND ${CONVERT_BIN} -background none -resize !512x512 squawk.svg "icns.iconset/icon_512x512.png" WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
execute_process(COMMAND ${CONVERT_BIN} -background none -resize !1024x1024 squawk.svg "icns.iconset/icon_512x512@2x.png" WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
execute_process(COMMAND iconutil -c icns "icns.iconset" -o "squawk.icns" WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
set(MACOSX_BUNDLE_ICON_FILE squawk.icns)
|
||||
set(MACOSX_BUNDLE_ICON_FILE ${MACOSX_BUNDLE_ICON_FILE} PARENT_SCOPE)
|
||||
|
@ -16,9 +16,6 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef SHARED_DEFINES_H
|
||||
#define SHARED_DEFINES_H
|
||||
#pragma once
|
||||
|
||||
#define SHARED_UNUSED(x) (void)(x)
|
||||
|
||||
#endif
|
||||
|
@ -19,12 +19,20 @@
|
||||
#include "global.h"
|
||||
#include <QFontDatabase>
|
||||
|
||||
#include "defines.h"
|
||||
#include "enums.h"
|
||||
#include "ui/models/roster.h"
|
||||
|
||||
#ifdef WITH_SIMPLE_CRYPT
|
||||
#define SIMPLE_CRYPT_ENABLED true
|
||||
#else
|
||||
#define SIMPLE_CRYPT_ENABLED false
|
||||
#endif
|
||||
|
||||
#ifdef WITH_OMEMO
|
||||
constexpr bool OMEMO_SUPPORT = true;
|
||||
#else
|
||||
constexpr bool OMEMO_SUPPORT = false
|
||||
constexpr bool OMEMO_SUPPORT = false;
|
||||
#endif
|
||||
|
||||
QFont getFont (QFontDatabase::SystemFont type, bool bold = false, bool italic = false, qreal factor = 1.0) {
|
||||
@ -36,12 +44,11 @@ QFont getFont (QFontDatabase::SystemFont type, bool bold = false, bool italic =
|
||||
|
||||
if (factor != 1.0) {
|
||||
float ps = font.pointSizeF();
|
||||
if (ps != -1) {
|
||||
if (ps != -1)
|
||||
font.setPointSizeF(ps * factor);
|
||||
} else {
|
||||
else
|
||||
font.setPointSize(font.pointSize() * factor);
|
||||
}
|
||||
}
|
||||
|
||||
return font;
|
||||
}
|
||||
@ -50,12 +57,12 @@ Shared::Global* Shared::Global::instance = 0;
|
||||
const std::set<QString> Shared::Global::supportedImagesExts = {"png", "jpg", "webp", "jpeg", "gif", "svg"};
|
||||
|
||||
#ifdef WITH_KIO
|
||||
QLibrary Shared::Global::openFileManagerWindowJob("openFileManagerWindowJob");
|
||||
QLibrary Shared::Global::openFileManagerWindowJob(QString("%1/openFileManagerWindowJob").arg(PLUGIN_PATH));
|
||||
Shared::Global::HighlightInFileManager Shared::Global::hfm = 0;
|
||||
#endif
|
||||
|
||||
#ifdef WITH_KCONFIG
|
||||
QLibrary Shared::Global::colorSchemeTools("colorSchemeTools");
|
||||
QLibrary Shared::Global::colorSchemeTools(QString("%1/colorSchemeTools").arg(PLUGIN_PATH));
|
||||
Shared::Global::CreatePreview Shared::Global::createPreview = 0;
|
||||
Shared::Global::DeletePreview Shared::Global::deletePreview = 0;
|
||||
Shared::Global::ColorSchemeName Shared::Global::colorSchemeName = 0;
|
||||
@ -148,10 +155,11 @@ Shared::Global::Global():
|
||||
smallFontMetrics(smallFont),
|
||||
headerFontMetrics(headerFont),
|
||||
titleFontMetrics(titleFont),
|
||||
pluginSupport({
|
||||
optionalFeatures({
|
||||
{"KWallet", false},
|
||||
{"openFileManagerWindowJob", false},
|
||||
{"colorSchemeTools", false}
|
||||
{"colorSchemeTools", false},
|
||||
{"simpleCryptJammedPassword", SIMPLE_CRYPT_ENABLED}
|
||||
}),
|
||||
fileCache()
|
||||
{
|
||||
@ -197,8 +205,7 @@ Shared::Global::Global():
|
||||
|
||||
|
||||
static const QSize defaultIconFileInfoHeight(50, 50);
|
||||
Shared::Global::FileInfo Shared::Global::getFileInfo(const QString& path)
|
||||
{
|
||||
Shared::Global::FileInfo Shared::Global::getFileInfo(const QString& path) {
|
||||
std::map<QString, FileInfo>::const_iterator itr = instance->fileCache.find(path);
|
||||
if (itr == instance->fileCache.end()) {
|
||||
QMimeDatabase db;
|
||||
@ -275,17 +282,17 @@ QString Shared::Global::getName(EncryptionProtocol ep) {
|
||||
}
|
||||
|
||||
void Shared::Global::setSupported(const QString& pluginName, bool support) {
|
||||
std::map<QString, bool>::iterator itr = instance->pluginSupport.find(pluginName);
|
||||
if (itr != instance->pluginSupport.end()) {
|
||||
std::map<QString, bool>::iterator itr = instance->optionalFeatures.find(pluginName);
|
||||
if (itr != instance->optionalFeatures.end()) {
|
||||
itr->second = support;
|
||||
}
|
||||
}
|
||||
|
||||
bool Shared::Global::supported(const QString& pluginName) {
|
||||
std::map<QString, bool>::iterator itr = instance->pluginSupport.find(pluginName);
|
||||
if (itr != instance->pluginSupport.end()) {
|
||||
std::map<QString, bool>::iterator itr = instance->optionalFeatures.find(pluginName);
|
||||
if (itr != instance->optionalFeatures.end())
|
||||
return itr->second;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -325,11 +332,10 @@ void Shared::Global::highlightInFileManager(const QString& path)
|
||||
QString output = proc.readLine().simplified();
|
||||
|
||||
QString folder;
|
||||
if (info.isDir()) {
|
||||
if (info.isDir())
|
||||
folder = info.canonicalFilePath();
|
||||
} else {
|
||||
else
|
||||
folder = info.canonicalPath();
|
||||
}
|
||||
|
||||
if (output.contains(dolphinReg)) {
|
||||
//there is a bug on current (21.04.0) dolphin, it works correct only if you already have dolphin launched
|
||||
@ -356,27 +362,32 @@ void Shared::Global::highlightInFileManager(const QString& path)
|
||||
}
|
||||
|
||||
QIcon Shared::Global::createThemePreview(const QString& path) {
|
||||
#ifdef WITH_KCONFIG
|
||||
if (supported("colorSchemeTools")) {
|
||||
QIcon* icon = createPreview(path);
|
||||
QIcon localIcon = *icon;
|
||||
deletePreview(icon);
|
||||
return localIcon;
|
||||
} else {
|
||||
return QIcon();
|
||||
}
|
||||
#endif
|
||||
|
||||
return QIcon();
|
||||
}
|
||||
|
||||
QString Shared::Global::getColorSchemeName(const QString& path) {
|
||||
#ifdef WITH_KCONFIG
|
||||
if (supported("colorSchemeTools")) {
|
||||
QString res;
|
||||
colorSchemeName(path, res);
|
||||
return res;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
#endif
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
void Shared::Global::setTheme(const QString& path) {
|
||||
#ifdef WITH_KCONFIG
|
||||
if (supported("colorSchemeTools")) {
|
||||
if (path.toLower() == "system") {
|
||||
QApplication::setPalette(getInstance()->defaultSystemPalette);
|
||||
@ -386,23 +397,26 @@ void Shared::Global::setTheme(const QString& path) {
|
||||
QApplication::setPalette(pallete);
|
||||
}
|
||||
}
|
||||
#else
|
||||
SHARED_UNUSED(path);
|
||||
qDebug("setTheme() was called, but this version of squawk was compiled without KConfig support, ignoring");
|
||||
#endif
|
||||
}
|
||||
|
||||
void Shared::Global::setStyle(const QString& style) {
|
||||
if (style.toLower() == "system") {
|
||||
if (style.toLower() == "system")
|
||||
QApplication::setStyle(getInstance()->defaultSystemStyle);
|
||||
} else {
|
||||
else
|
||||
QApplication::setStyle(style);
|
||||
}
|
||||
}
|
||||
|
||||
#define FROM_INT_INPL(Enum) \
|
||||
template<> \
|
||||
Enum Shared::Global::fromInt(int src) \
|
||||
{ \
|
||||
if (src < static_cast<int>(Enum##Lowest) || src > static_cast<int>(Enum##Highest)) { \
|
||||
if (src < static_cast<int>(Enum##Lowest) || src > static_cast<int>(Enum##Highest)) \
|
||||
throw EnumOutOfRange(#Enum); \
|
||||
} \
|
||||
\
|
||||
return static_cast<Enum>(src); \
|
||||
} \
|
||||
template<> \
|
||||
|
@ -135,7 +135,7 @@ namespace Shared {
|
||||
private:
|
||||
static Global* instance;
|
||||
|
||||
std::map<QString, bool> pluginSupport;
|
||||
std::map<QString, bool> optionalFeatures;
|
||||
std::map<QString, FileInfo> fileCache;
|
||||
|
||||
#ifdef WITH_KIO
|
||||
|
@ -31,7 +31,7 @@ namespace Shared {
|
||||
*
|
||||
* under development yet
|
||||
*/
|
||||
class Info : public QObject, public VCard {
|
||||
class Info {
|
||||
public:
|
||||
Info ();
|
||||
Info (const QString& address, EntryType = EntryType::none);
|
||||
|
@ -19,13 +19,13 @@
|
||||
#include <QXmppGlobal.h>
|
||||
#include <QDebug>
|
||||
|
||||
#if (QXMPP_VERSION) < QT_VERSION_CHECK(1, 3, 0)
|
||||
static const std::string QXMPP_VERSION_PATCH(std::to_string(QXMPP_VERSION & 0xff));
|
||||
static const std::string QXMPP_VERSION_MINOR(std::to_string((QXMPP_VERSION & 0xff00) >> 8));
|
||||
static const std::string QXMPP_VERSION_MAJOR(std::to_string(QXMPP_VERSION >> 16));
|
||||
static const QString QXMPP_VERSION_STRING = QString::fromStdString(QXMPP_VERSION_MAJOR + "." + QXMPP_VERSION_MINOR + "." + QXMPP_VERSION_PATCH);
|
||||
#if (QXMPP_VERSION) < QT_VERSION_CHECK(1, 2, 0)
|
||||
static const std::string _QXMPP_PATCH_(std::to_string(QXMPP_VERSION & 0xff));
|
||||
static const std::string _QXMPP_MINOR_(std::to_string((QXMPP_VERSION & 0xff00) >> 8));
|
||||
static const std::string _QXMPP_MAJOR_(std::to_string(QXMPP_VERSION >> 16));
|
||||
static const QString SQUAWK_INNER_QXMPP_VERSION_STRING = QString::fromStdString(_QXMPP_MAJOR_ + "." + _QXMPP_MINOR_ + "." + _QXMPP_PATCH_);
|
||||
#else
|
||||
static const QString QXMPP_VERSION_STRING = QXmppVersion();
|
||||
static const QString SQUAWK_INNER_QXMPP_VERSION_STRING = QXmppVersion();
|
||||
#endif
|
||||
|
||||
About::About(QWidget* parent):
|
||||
@ -39,7 +39,7 @@ About::About(QWidget* parent):
|
||||
m_ui->qtBuiltAgainstVersion->setText(tr("(built against %1)").arg(QT_VERSION_STR));
|
||||
|
||||
m_ui->qxmppVersionValue->setText(QXmppVersion());
|
||||
m_ui->qxmppBuiltAgainstVersion->setText(tr("(built against %1)").arg(QXMPP_VERSION_STRING));
|
||||
m_ui->qxmppBuiltAgainstVersion->setText(tr("(built against %1)").arg(SQUAWK_INNER_QXMPP_VERSION_STRING));
|
||||
|
||||
setWindowFlag(Qt::Tool);
|
||||
|
||||
@ -52,8 +52,7 @@ About::~About() {
|
||||
}
|
||||
};
|
||||
|
||||
void About::onLicenseActivated()
|
||||
{
|
||||
void About::onLicenseActivated() {
|
||||
if (license == nullptr) {
|
||||
QFile file;
|
||||
bool found = false;
|
||||
@ -106,7 +105,6 @@ void About::onLicenseActivated()
|
||||
license->show();
|
||||
}
|
||||
|
||||
void About::onLicenseClosed()
|
||||
{
|
||||
void About::onLicenseClosed() {
|
||||
license = nullptr;
|
||||
}
|
||||
|
@ -14,8 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#ifndef ABOUT_H
|
||||
#define ABOUT_H
|
||||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
#include <QScopedPointer>
|
||||
@ -24,16 +23,11 @@
|
||||
#include <QTextStream>
|
||||
#include <QStandardPaths>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
namespace Ui{
|
||||
class About;
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo write docs
|
||||
*/
|
||||
class About : public QWidget
|
||||
{
|
||||
class About : public QWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
About(QWidget* parent = nullptr);
|
||||
@ -47,5 +41,3 @@ private:
|
||||
QScopedPointer<Ui::About> m_ui;
|
||||
QWidget* license;
|
||||
};
|
||||
|
||||
#endif // ABOUT_H
|
||||
|
@ -26,6 +26,7 @@ Account::Account():
|
||||
m_ui->setupUi(this);
|
||||
|
||||
connect(m_ui->passwordType, qOverload<int>(&QComboBox::currentIndexChanged), this, &Account::onComboboxChange);
|
||||
QStandardItemModel *model = static_cast<QStandardItemModel*>(m_ui->passwordType->model());
|
||||
|
||||
for (int i = static_cast<int>(Shared::AccountPasswordLowest); i < static_cast<int>(Shared::AccountPasswordHighest) + 1; ++i) {
|
||||
Shared::AccountPassword ap = static_cast<Shared::AccountPassword>(i);
|
||||
@ -34,18 +35,19 @@ Account::Account():
|
||||
m_ui->passwordType->setCurrentIndex(static_cast<int>(Shared::AccountPassword::plain));
|
||||
|
||||
if (!Shared::Global::supported("KWallet")) {
|
||||
QStandardItemModel *model = static_cast<QStandardItemModel*>(m_ui->passwordType->model());
|
||||
QStandardItem *item = model->item(static_cast<int>(Shared::AccountPassword::kwallet));
|
||||
item->setFlags(item->flags() & ~Qt::ItemIsEnabled);
|
||||
}
|
||||
|
||||
if (!Shared::Global::supported("simpleCryptJammedPassword")) {
|
||||
QStandardItem *item = model->item(static_cast<int>(Shared::AccountPassword::jammed));
|
||||
item->setFlags(item->flags() & ~Qt::ItemIsEnabled);
|
||||
}
|
||||
}
|
||||
|
||||
Account::~Account()
|
||||
{
|
||||
}
|
||||
Account::~Account() {}
|
||||
|
||||
QMap<QString, QVariant> Account::value() const
|
||||
{
|
||||
QMap<QString, QVariant> Account::value() const {
|
||||
QMap<QString, QVariant> map;
|
||||
map["login"] = m_ui->login->text();
|
||||
map["password"] = m_ui->password->text();
|
||||
@ -58,13 +60,11 @@ QMap<QString, QVariant> Account::value() const
|
||||
return map;
|
||||
}
|
||||
|
||||
void Account::lockId()
|
||||
{
|
||||
void Account::lockId() {
|
||||
m_ui->name->setReadOnly(true);;
|
||||
}
|
||||
|
||||
void Account::setData(const QMap<QString, QVariant>& data)
|
||||
{
|
||||
void Account::setData(const QMap<QString, QVariant>& data) {
|
||||
m_ui->login->setText(data.value("login").toString());
|
||||
m_ui->password->setText(data.value("password").toString());
|
||||
m_ui->server->setText(data.value("server").toString());
|
||||
@ -73,8 +73,7 @@ void Account::setData(const QMap<QString, QVariant>& data)
|
||||
m_ui->passwordType->setCurrentIndex(data.value("passwordType").toInt());
|
||||
}
|
||||
|
||||
void Account::onComboboxChange(int index)
|
||||
{
|
||||
void Account::onComboboxChange(int index) {
|
||||
QString description = Shared::Global::getDescription(Shared::Global::fromInt<Shared::AccountPassword>(index));
|
||||
m_ui->comment->setText(description);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user