# General setup
#####################################################################
-cmake_minimum_required(VERSION 2.8.9) # You'll need at least 2.8.12 for KDE Frameworks integration
project(QuasselIRC)
# Versions
set(QUASSEL_MAJOR 0)
set(QUASSEL_MINOR 12)
set(QUASSEL_PATCH 0)
-set(QUASSEL_VERSION_STRING "0.12-pre")
+set(QUASSEL_VERSION_STRING "0.12-beta1")
# Tell CMake about or own modules
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
include(QuasselCompileSettings)
include(QuasselMacros)
-# Setting COMPILE_DEFINITIONS_<CONFIG> is deprecated since CMake 3.0 in favor of generator expressions.
-# These have existed since CMake 2.8.10; until we depend on that, we have to explicitly enable the old policy.
-if (CMAKE_MAJOR_VERSION GREATER 2)
- cmake_policy(SET CMP0043 OLD)
-endif()
# Options and variables that can be set on the command line
#####################################################################
endif()
+# Setup CMake
+#####################################################################
+
+if (USE_QT5 AND WITH_KDE)
+ cmake_minimum_required(VERSION 2.8.12)
+else()
+ cmake_minimum_required(VERSION 2.8.9)
+endif()
+
+# Setting COMPILE_DEFINITIONS_<CONFIG> is deprecated since CMake 3.0 in favor of generator expressions.
+# These have existed since CMake 2.8.10; until we depend on that, we have to explicitly enable the old policy.
+if (CMAKE_MAJOR_VERSION GREATER 2)
+ cmake_policy(SET CMP0043 OLD)
+endif()
+
+
# Simplify later checks
#####################################################################
endif()
if (WITH_KDE)
- find_package(KF5CoreAddons QUIET)
- set_package_properties(KF5CoreAddons PROPERTIES TYPE REQUIRED
- URL "http://inqlude.org/libraries/kcoreaddons.html"
- DESCRIPTION "framework for solving common problems such as caching, randomization, and more"
- PURPOSE "Required for KDE Frameworks integration"
- )
-
- find_package(KF5TextWidgets QUIET)
- set_package_properties(KF5TextWidgets PROPERTIES TYPE REQUIRED
- URL "http://inqlude.org/libraries/ktextwidgets.html"
- DESCRIPTION "framework providing an assortment of widgets for displaying and editing text"
- PURPOSE "Allows to use extra features provided by KDE Frameworks in input widgets"
+ find_package(KF5 COMPONENTS ConfigWidgets CoreAddons Notifications NotifyConfig TextWidgets WidgetsAddons XmlGui QUIET)
+ set_package_properties(KF5 PROPERTIES TYPE REQUIRED
+ URL "http://www.kde.org"
+ DESCRIPTION "KDE Frameworks"
+ PURPOSE "Required for integration into the Plasma desktop"
)
endif()
endif(BUILD_GUI)
+
if (BUILD_CORE)
find_package(Qt5Script QUIET)
set_package_properties(Qt5Script PROPERTIES TYPE REQUIRED
DESCRIPTION "contains tools for handling translation files"
PURPOSE "Required for having translations"
)
+
# Some Qt5 versions do not define a target for lconvert, so we need to find it ourselves
if (Qt5LinguistTools_FOUND)
if (NOT TARGET Qt5::lconvert AND TARGET Qt5::lrelease)
add_definitions(-U__STRICT_ANSI__)
endif()
+# Sanitize compiler flags - old versions of KDE set -ansi, which breaks -std=c++11
+if (CMAKE_COMPILER_IS_GNUCXX)
+ string(REPLACE "-ansi" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
+endif()
+
# Setup KDE / KDE Frameworks
#####################################################################
get_git_head_revision(GIT_REFSPEC GIT_HEAD)
git_describe(GIT_DESCRIBE --long)
+# If not in a Git repo try to read GIT_HEAD and GIT_DESCRIBE from
+# enviroment
+if (NOT GIT_HEAD OR NOT GIT_DESCRIBE)
+ if (DEFINED ENV{GIT_HEAD})
+ set(GIT_HEAD ${GIT_HEAD})
+ endif ()
+ if (DEFINED ENV{GIT_DESCRIBE})
+ set(GIT_DESCRIBE ${GIT_DESCRIBE})
+ endif()
+endif()
+
# Sanitize things if we're not in a Git repo
if (NOT GIT_HEAD OR NOT GIT_DESCRIBE)
set(GIT_HEAD "")
Without further ado, let's start:
+Version 0.12.0 (TBA)
+====================
+
+* Full support for KDE Frameworks
+* Remote password change
+* Core connection improvements
+* Build system improvements
+* PostgreSQL connection improvements
+* Improve Qt5 support
+* Qt 4.8+ or Qt 5.2+ now required
+* Several tweaks and fixes
+
Version 0.11.0 (2014-09-23)
===========================
fairly recent compiler:
- gcc 4.7+ (available for most platforms), or
-- Clang 3.2+ (available for most platforms, or
+- Clang 3.2+ (available for most platforms), or
- XCode 4.6+ (available for Max OS X and based on Clang), or
-- Visual C++ 2013 (available for Windows™), or
+- Visual C++ Nov 2013 CTP (available for Windows™), or
- any other compiler with decent C++11 support
-Furthermore, CMake 2.8.9 or later is required.
+Furthermore, CMake 2.8.9 or later is required (2.8.12 for KDE Frameworks).
-As Quassel is a Qt application, you need the Qt SDK, either Qt 4.6+ or Qt 5.2+.
+As Quassel is a Qt application, you need the Qt SDK, either Qt 4.8+ or Qt 5.2+.
There are several optional dependencies; we will talk about that later.
in a separate build directory rather than in-source. That way, your source
checkout remains pristine, and you can easily remove any build artifacts by just
deleting the build directory. This directory can be located anywhere; in the
-short example above, we just created a directory called "build" inside the
+short example above, we've just created a directory called "build" inside the
source checkout.
From inside the build directory, you can then run the "cmake" command, followed
things may happen.
-DWITH_KDE=ON
- Enable integration into KDE4; only available if -DUSE_QT5=OFF
+ Enable integration into KDE4 (with Qt4) or KDE Frameworks (with Qt5).
-DWITH_OXYGEN=(ON|OFF)
Install the parts of the Oxygen icon set Quassel uses. Oxygen is the default
-DWITH_WEBKIT=OFF
Use Webkit for showing previews of webpages linked in the chat. Requires
the QtWebkit module to be available, and increases the client's RAM usage
- by *a lot* if enabled at runtime.
+ by *a lot* if enabled at runtime. Note also that Webkit frequently crashes
+ especially on Windows.
-DEMBED_DATA=(ON|OFF)
Specifies whether Quassel's data files (icons, translations and so on)
install(FILES quassel.desktop DESTINATION ${CMAKE_INSTALL_APPDIR})
endif()
- if (KDE4_FOUND)
+ if (WITH_KDE4)
install(FILES quassel.notifyrc DESTINATION ${CMAKE_INSTALL_DATADIR}/quassel)
endif()
+
+ if (WITH_KF5)
+ install(FILES quassel.notifyrc DESTINATION ${CMAKE_INSTALL_KNOTIFY5RCDIR})
+ endif()
endif()
if (EMBED_DATA)
opendir (SIZEDIR, "$oxygen/$sizestr") or die "Could not open dir $sizestr\n";
foreach my $cat (readdir SIZEDIR) {
next if $cat eq '.' or $cat eq '..';
- #system "mkdir -p $output/$sizestr/$cat" and die "Could not create category dir\n";
- system "mkdir -p $output/scalable/$cat" and die "Could not create category dir\n";
opendir (CATDIR, "$oxygen/$sizestr/$cat") or die "Could not open category dir\n";
foreach my $icon (readdir CATDIR) {
$icon =~ s/\.png$//;
print "Warning: Missing icon $icon\n";
}
+# Copy license etc.
+system "cp $oxygen/AUTHORS $oxygen/CONTRIBUTING $oxygen/COPYING $oxygen/index.theme $output/";
+
# Generate .qrc
my @file_list;
generate_qrc($output, $qrcfile_kde);
-# Copy license etc.
-system "cp $oxygen/AUTHORS $oxygen/CONTRIBUTING $oxygen/COPYING $oxygen/index.theme $output/";
-
print "Done.\n";
########################################################################################
}
sub push_icon_path {
- return unless /\.png$/;
+ return unless /\.png$/ or /^index.theme$/;
push @file_list, " <file>$File::Find::name</file>";
}
<RCC>
<qresource prefix="/icons">
+ <file>oxygen/index.theme</file>
<file>oxygen/22x22/actions/irc-voice.png</file>
<file>oxygen/22x22/actions/go-next.png</file>
<file>oxygen/22x22/actions/im-user.png</file>
clientcoreinfo.h
)
-if (KDE4_FOUND)
- include_directories(${KDE4_INCLUDES})
- add_definitions(-DHAVE_KDE ${KDE4_DEFINITIONS})
-endif()
-
if (USE_QT5)
list(APPEND qt_modules Widgets)
endif()
qt_use_modules(mod_client Network Core Gui ${qt_modules})
target_link_libraries(mod_client mod_common)
-
-if (KDE4_FOUND)
- target_link_libraries(mod_client ${KDE4_SOLID_LIBS})
-endif()
#include "quassel.h"
#include "signalproxy.h"
#include "util.h"
+#include "clientauthhandler.h"
#include <stdio.h>
#include <stdlib.h>
p->attachSlot(SIGNAL(networkCreated(NetworkId)), this, SLOT(coreNetworkCreated(NetworkId)));
p->attachSlot(SIGNAL(networkRemoved(NetworkId)), this, SLOT(coreNetworkRemoved(NetworkId)));
+ p->attachSignal(this, SIGNAL(requestPasswordChange(PeerPtr,QString,QString,QString)), SIGNAL(changePassword(PeerPtr,QString,QString,QString)));
+ p->attachSlot(SIGNAL(passwordChanged(PeerPtr,bool)), this, SLOT(corePasswordChanged(PeerPtr,bool)));
+
//connect(mainUi(), SIGNAL(connectToCore(const QVariantMap &)), this, SLOT(connectToCore(const QVariantMap &)));
connect(mainUi(), SIGNAL(disconnectFromCore()), this, SLOT(disconnectFromCore()));
connect(this, SIGNAL(connected()), mainUi(), SLOT(connectedToCore()));
connect(bufferSyncer(), SIGNAL(buffersPermanentlyMerged(BufferId, BufferId)), _messageModel, SLOT(buffersPermanentlyMerged(BufferId, BufferId)));
connect(bufferSyncer(), SIGNAL(bufferMarkedAsRead(BufferId)), SIGNAL(bufferMarkedAsRead(BufferId)));
connect(networkModel(), SIGNAL(requestSetLastSeenMsg(BufferId, MsgId)), bufferSyncer(), SLOT(requestSetLastSeenMsg(BufferId, const MsgId &)));
- signalProxy()->synchronize(bufferSyncer());
+
+ SignalProxy *p = signalProxy();
+ p->synchronize(bufferSyncer());
// create a new BufferViewManager
Q_ASSERT(!_bufferViewManager);
- _bufferViewManager = new ClientBufferViewManager(signalProxy(), this);
+ _bufferViewManager = new ClientBufferViewManager(p, this);
connect(_bufferViewManager, SIGNAL(initDone()), _bufferViewOverlay, SLOT(restore()));
// create AliasManager
Q_ASSERT(!_aliasManager);
_aliasManager = new ClientAliasManager(this);
connect(aliasManager(), SIGNAL(initDone()), SLOT(sendBufferedUserInput()));
- signalProxy()->synchronize(aliasManager());
+ p->synchronize(aliasManager());
// create NetworkConfig
Q_ASSERT(!_networkConfig);
_networkConfig = new NetworkConfig("GlobalNetworkConfig", this);
- signalProxy()->synchronize(networkConfig());
+ p->synchronize(networkConfig());
// create IgnoreListManager
Q_ASSERT(!_ignoreListManager);
_ignoreListManager = new ClientIgnoreListManager(this);
- signalProxy()->synchronize(ignoreListManager());
+ p->synchronize(ignoreListManager());
Q_ASSERT(!_transferManager);
_transferManager = new ClientTransferManager(this);
- signalProxy()->synchronize(transferManager());
+ p->synchronize(transferManager());
// trigger backlog request once all active bufferviews are initialized
connect(bufferViewOverlay(), SIGNAL(initDone()), this, SLOT(requestInitialBacklog()));
}
+void Client::changePassword(const QString &oldPassword, const QString &newPassword) {
+ CoreAccount account = currentCoreAccount();
+ account.setPassword(newPassword);
+ coreAccountModel()->createOrUpdateAccount(account);
+ emit instance()->requestPasswordChange(nullptr, account.user(), oldPassword, newPassword);
+}
+
+
+void Client::corePasswordChanged(PeerPtr, bool success)
+{
+ if (success)
+ coreAccountModel()->save();
+ emit passwordChanged(success);
+}
+
+
#if QT_VERSION < 0x050000
void Client::logMessage(QtMsgType type, const char *msg)
{
static void mergeBuffersPermanently(BufferId bufferId1, BufferId bufferId2);
static void purgeKnownBufferIds();
+ static void changePassword(const QString &oldPassword, const QString &newPassword);
+
#if QT_VERSION < 0x050000
static void logMessage(QtMsgType type, const char *msg);
#else
*/
void bufferMarkedAsRead(BufferId id);
+ //! Requests a password change (user name must match the currently logged in user)
+ void requestPasswordChange(PeerPtr peer, const QString &userName, const QString &oldPassword, const QString &newPassword);
+ void passwordChanged(bool success);
+
public slots:
void disconnectFromCore();
void coreNetworkCreated(NetworkId);
void coreNetworkRemoved(NetworkId);
+ void corePasswordChanged(PeerPtr, bool success);
+
void requestInitialBacklog();
void sendBufferedUserInput();
CoreConnectionSettings::NetworkDetectionMode CoreConnectionSettings::networkDetectionMode()
{
-#ifdef HAVE_KDE4
- NetworkDetectionMode def = UseSolid;
-#else
- NetworkDetectionMode def = UseQNetworkConfigurationManager;
-#endif
- return (NetworkDetectionMode)localValue("NetworkDetectionMode", def).toInt();
+ auto mode = localValue("NetworkDetectionMode", UseQNetworkConfigurationManager).toInt();
+ if (mode == 0)
+ mode = UseQNetworkConfigurationManager; // UseSolid is gone, map that to the new default
+ return static_cast<NetworkDetectionMode>(mode);
}
{
public:
enum NetworkDetectionMode {
- UseSolid,
- UseQNetworkConfigurationManager,
+ UseQNetworkConfigurationManager = 1, // UseSolid is gone
UsePingTimeout,
NoActiveDetection
};
_progressMinimum(0),
_progressMaximum(-1),
_progressValue(-1),
- _resetting(false),
- _qNetworkConfigurationManager(0)
+ _resetting(false)
{
qRegisterMetaType<ConnectionState>("CoreConnection::ConnectionState");
}
_reconnectTimer.setSingleShot(true);
connect(&_reconnectTimer, SIGNAL(timeout()), SLOT(reconnectTimeout()));
-#ifdef HAVE_KDE4
- connect(Solid::Networking::notifier(), SIGNAL(statusChanged(Solid::Networking::Status)),
- SLOT(solidNetworkStatusChanged(Solid::Networking::Status)));
-#endif
_qNetworkConfigurationManager = new QNetworkConfigurationManager(this);
connect(_qNetworkConfigurationManager, SIGNAL(onlineStateChanged(bool)), SLOT(onlineStateChanged(bool)));
if (!_peer) {
CoreConnectionSettings s;
if (_wantReconnect && s.autoReconnect()) {
-#ifdef HAVE_KDE4
- // If using Solid, we don't want to reconnect if we're offline
- if (s.networkDetectionMode() == CoreConnectionSettings::UseSolid) {
- if (Solid::Networking::status() != Solid::Networking::Connected
- && Solid::Networking::status() != Solid::Networking::Unknown) {
- return;
- }
- }
-#endif /* HAVE_KDE4 */
- // If using QNetworkConfigurationManager, ditto
+ // If using QNetworkConfigurationManager, we don't want to reconnect if we're offline
if (s.networkDetectionMode() == CoreConnectionSettings::UseQNetworkConfigurationManager) {
if (!_qNetworkConfigurationManager->isOnline()) {
return;
}
}
-
reconnectToCore();
}
}
}
-#ifdef HAVE_KDE4
-
-void CoreConnection::solidNetworkStatusChanged(Solid::Networking::Status status)
-{
- CoreConnectionSettings s;
- if (s.networkDetectionMode() != CoreConnectionSettings::UseSolid)
- return;
-
- switch (status) {
- case Solid::Networking::Unknown:
- case Solid::Networking::Connected:
- //qDebug() << "Solid: Network status changed to connected or unknown";
- if (state() == Disconnected) {
- if (_wantReconnect && s.autoReconnect()) {
- reconnectToCore();
- }
- }
- break;
- case Solid::Networking::Disconnecting:
- case Solid::Networking::Unconnected:
- if (state() != Disconnected && !isLocalConnection())
- disconnectFromCore(tr("Network is down"), true);
- break;
- default:
- break;
- }
-}
-
-#endif
-
void CoreConnection::onlineStateChanged(bool isOnline)
{
CoreConnectionSettings s;
}
}
+
bool CoreConnection::isEncrypted() const
{
return _peer && _peer->isSecure();
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
-#ifndef CORECONNECTION_H_
-#define CORECONNECTION_H_
+#pragma once
-#include "QPointer"
-#include "QTimer"
+#include <QNetworkConfigurationManager>
+#include <QPointer>
+#include <QTimer>
#ifdef HAVE_SSL
# include <QSslSocket>
# include <QTcpSocket>
#endif
-#ifdef HAVE_KDE4
-# include <Solid/Networking>
-#endif
-
-#include <QNetworkConfigurationManager>
-
#include "coreaccount.h"
#include "remotepeer.h"
#include "types.h"
void reconnectIntervalChanged(const QVariant &interval);
void reconnectTimeout();
-#ifdef HAVE_KDE4
- void solidNetworkStatusChanged(Solid::Networking::Status status);
-#endif
void onlineStateChanged(bool isOnline);
private:
inline CoreConnection::ConnectionState CoreConnection::state() const { return _state; }
inline bool CoreConnection::isConnected() const { return state() >= Connected; }
inline CoreAccount CoreConnection::currentAccount() const { return _account; }
-
-#endif
# include "kcmdlinewrapper.h"
#elif defined HAVE_KF5
# include <KCoreAddons/KAboutData>
+# include <KCoreAddons/Kdelibs4ConfigMigrator>
# include "qt5cliparser.h"
#elif defined HAVE_QT5
# include "qt5cliparser.h"
# endif
#endif
+ // Migrate settings from KDE4 to KF5 if appropriate
+#ifdef HAVE_KF5
+ Kdelibs4ConfigMigrator migrator(QCoreApplication::applicationName());
+ migrator.setConfigFiles(QStringList() << "quasselrc" << "quassel.notifyrc");
+ migrator.migrate();
+#endif
+
AbstractCliParser *cliParser;
#ifdef HAVE_KDE4
}
#endif
- if (!app.init())
- return EXIT_FAILURE;
-
#ifdef HAVE_KF5
// FIXME: This should be done after loading the translation catalogue, but still in main()
AboutData aboutData;
KAboutData::setApplicationData(aboutData.kAboutData());
#endif
+ if (!app.init())
+ return EXIT_FAILURE;
+
return app.exec();
}
{
return _authHandler;
}
+
+
+// Note that we need to use a fixed-size integer instead of uintptr_t, in order
+// to avoid issues with different architectures for client and core.
+// In practice, we'll never really have to restore the real value of a PeerPtr from
+// a QVariant.
+QDataStream &operator<<(QDataStream &out, PeerPtr ptr)
+{
+ out << reinterpret_cast<quint64>(ptr);
+ return out;
+}
+
+QDataStream &operator>>(QDataStream &in, PeerPtr &ptr)
+{
+ quint64 value;
+ in >> value;
+ ptr = reinterpret_cast<PeerPtr>(value);
+ return in;
+}
typedef Peer * PeerPtr;
Q_DECLARE_METATYPE(PeerPtr)
+QDataStream &operator<<(QDataStream &out, PeerPtr ptr);
+QDataStream &operator>>(QDataStream &in, PeerPtr &ptr);
+
// Template method needed in the header
template<typename T> inline
#include "logger.h"
#include "message.h"
#include "network.h"
+#include "peer.h"
#include "protocol.h"
#include "syncableobject.h"
#include "types.h"
qRegisterMetaTypeStreamOperators<MsgId>("MsgId");
qRegisterMetaType<Protocol::SessionState>("Protocol::SessionState");
+ qRegisterMetaType<PeerPtr>("PeerPtr");
+ qRegisterMetaTypeStreamOperators<PeerPtr>("PeerPtr");
// Versions of Qt prior to 4.7 didn't define QVariant as a meta type
if (!QMetaType::type("QVariant")) {
QStringList Quassel::findDataDirPaths() const
{
- QStringList dataDirNames = QString(qgetenv("XDG_DATA_DIRS")).split(':', QString::SkipEmptyParts);
+ // We don't use QStandardPaths for now, as we still need to provide fallbacks for Qt4 and
+ // want to stay consistent.
- if (!dataDirNames.isEmpty()) {
- for (int i = 0; i < dataDirNames.count(); i++)
- dataDirNames[i].append("/apps/quassel/");
- }
- else {
- // Provide a fallback
+ QStringList dataDirNames;
#ifdef Q_OS_WIN
- dataDirNames << qgetenv("APPDATA") + QCoreApplication::organizationDomain() + "/share/apps/quassel/"
- << qgetenv("APPDATA") + QCoreApplication::organizationDomain()
- << QCoreApplication::applicationDirPath();
- }
+ dataDirNames << qgetenv("APPDATA") + QCoreApplication::organizationDomain() + "/share/apps/quassel/"
+ << qgetenv("APPDATA") + QCoreApplication::organizationDomain()
+ << QCoreApplication::applicationDirPath();
#elif defined Q_OS_MAC
- dataDirNames << QDir::homePath() + "/Library/Application Support/Quassel/"
- << QCoreApplication::applicationDirPath();
- }
+ dataDirNames << QDir::homePath() + "/Library/Application Support/Quassel/"
+ << QCoreApplication::applicationDirPath();
#else
- dataDirNames.append("/usr/share/apps/quassel/");
- }
- // on UNIX, we always check our install prefix
- QString appDir = QCoreApplication::applicationDirPath();
- int binpos = appDir.lastIndexOf("/bin");
- if (binpos >= 0) {
- appDir.replace(binpos, 4, "/share");
- appDir.append("/apps/quassel/");
- if (!dataDirNames.contains(appDir))
- dataDirNames.append(appDir);
- }
+ // Linux et al
+
+ // XDG_DATA_HOME is the location for users to override system-installed files, usually in .local/share
+ // This should thus come first.
+ QString xdgDataHome = QFile::decodeName(qgetenv("XDG_DATA_HOME"));
+ if (xdgDataHome.isEmpty())
+ xdgDataHome = QDir::homePath() + QLatin1String("/.local/share");
+ dataDirNames << xdgDataHome;
+
+ // Now whatever is configured through XDG_DATA_DIRS
+ QString xdgDataDirs = QFile::decodeName(qgetenv("XDG_DATA_DIRS"));
+ if (xdgDataDirs.isEmpty())
+ dataDirNames << "/usr/local/share" << "/usr/share";
+ else
+ dataDirNames << xdgDataDirs.split(':', QString::SkipEmptyParts);
+
+ // Just in case, also check our install prefix
+ dataDirNames << QCoreApplication::applicationDirPath() + "/../share";
+
+ // Normalize and append our application name
+ for (int i = 0; i < dataDirNames.count(); i++)
+ dataDirNames[i] = QDir::cleanPath(dataDirNames.at(i)) + "/quassel/";
+
#endif
- // add resource path and workdir just in case
- dataDirNames << QCoreApplication::applicationDirPath() + "/data/"
- << ":/data/";
+ // Add resource path and workdir just in case.
+ // Workdir should have precedence
+ dataDirNames.prepend(QCoreApplication::applicationDirPath() + "/data/");
+ dataDirNames.append(":/data/");
- // append trailing '/' and check for existence
- QStringList::Iterator iter = dataDirNames.begin();
+ // Append trailing '/' and check for existence
+ auto iter = dataDirNames.begin();
while (iter != dataDirNames.end()) {
if (!iter->endsWith(QDir::separator()) && !iter->endsWith('/'))
iter->append(QDir::separator());
++iter;
}
+ dataDirNames.removeDuplicates();
+
return dataDirNames;
}
SaslAuthentication = 0x0002,
SaslExternal = 0x0004,
HideInactiveNetworks = 0x0008,
+ PasswordChange = 0x0010,
- NumFeatures = 0x0008
+ NumFeatures = 0x0010
};
Q_DECLARE_FLAGS(Features, Feature);
void RemotePeer::handle(const HeartBeatReply &heartBeatReply)
{
_heartBeatCount = 0;
-#if QT_VERSION >= 0x040700
emit lagUpdated(heartBeatReply.timestamp.msecsTo(QDateTime::currentDateTime().toUTC()) / 2);
-#else
- emit lagUpdated(heartBeatReply.timestamp.time().msecsTo(QDateTime::currentDateTime().toUTC().time()) / 2);
-#endif
}
foreach(CoreAuthHandler *handler, _connectingClients) {
handler->deleteLater(); // disconnect non authed clients
}
- qDeleteAll(sessions);
+ qDeleteAll(_sessions);
qDeleteAll(_storageBackends);
}
CoreSettings s;
QVariantMap state;
QVariantList activeSessions;
- foreach(UserId user, instance()->sessions.keys()) activeSessions << QVariant::fromValue<UserId>(user);
+ foreach(UserId user, instance()->_sessions.keys())
+ activeSessions << QVariant::fromValue<UserId>(user);
state["CoreStateVersion"] = 1;
state["ActiveSessions"] = activeSessions;
s.setCoreState(state);
// qWarning() << qPrintable(tr("Cannot restore a state for an unconfigured core!"));
return;
}
- if (instance()->sessions.count()) {
+ if (instance()->_sessions.count()) {
qWarning() << qPrintable(tr("Calling restoreState() even though active sessions exist!"));
return;
}
quInfo() << "Restoring previous core state...";
foreach(QVariant v, activeSessions) {
UserId user = v.value<UserId>();
- instance()->createSession(user, true);
+ instance()->sessionForUser(user, true);
}
}
}
handler->deleteLater();
// Find or create session for validated user
- SessionThread *session;
- if (sessions.contains(uid)) {
- session = sessions[uid];
- }
- else {
- session = createSession(uid);
- if (!session) {
- qWarning() << qPrintable(tr("Could not initialize session for client:")) << qPrintable(peer->description());
- peer->close();
- peer->deleteLater();
- return;
- }
- }
+ sessionForUser(uid);
// as we are currently handling an event triggered by incoming data on this socket
// it is unsafe to directly move the socket to the client thread.
void Core::addClientHelper(RemotePeer *peer, UserId uid)
{
// Find or create session for validated user
- if (!sessions.contains(uid)) {
- qWarning() << qPrintable(tr("Could not find a session for client:")) << qPrintable(peer->description());
- peer->close();
- peer->deleteLater();
- return;
- }
-
- SessionThread *session = sessions[uid];
+ SessionThread *session = sessionForUser(uid);
session->addClient(peer);
}
clientPeer->setPeer(corePeer);
// Find or create session for validated user
- SessionThread *sessionThread;
- if (sessions.contains(uid))
- sessionThread = sessions[uid];
- else
- sessionThread = createSession(uid);
-
+ SessionThread *sessionThread = sessionForUser(uid);
sessionThread->addClient(corePeer);
}
-SessionThread *Core::createSession(UserId uid, bool restore)
+SessionThread *Core::sessionForUser(UserId uid, bool restore)
{
- if (sessions.contains(uid)) {
- qWarning() << "Calling createSession() when a session for the user already exists!";
- return 0;
- }
- SessionThread *sess = new SessionThread(uid, restore, this);
- sessions[uid] = sess;
- sess->start();
- return sess;
+ if (_sessions.contains(uid))
+ return _sessions[uid];
+
+ SessionThread *session = new SessionThread(uid, restore, this);
+ _sessions[uid] = session;
+ session->start();
+ return session;
}
}
+bool Core::changeUserPassword(UserId userId, const QString &password)
+{
+ if (!isConfigured() || !userId.isValid())
+ return false;
+
+ return instance()->_storage->updateUser(userId, password);
+}
+
+
AbstractSqlMigrationReader *Core::getMigrationReader(Storage *storage)
{
if (!storage)
return instance()->_storage->validateUser(userName, password);
}
+
+ //! Change a user's password
+ /**
+ * \param userId The user's ID
+ * \param password The user's unencrypted new password
+ * \return true, if the password change was successful
+ */
+ static bool changeUserPassword(UserId userId, const QString &password);
+
//! Store a user setting persistently
/**
* \param userId The users Id
void socketError(QAbstractSocket::SocketError err, const QString &errorString);
void setupClientSession(RemotePeer *, UserId);
+ void changeUserPass(const QString &username);
+
private:
Core();
~Core();
void init();
static Core *instanceptr;
- SessionThread *createSession(UserId userId, bool restoreState = false);
+ SessionThread *sessionForUser(UserId userId, bool restoreState = false);
void addClientHelper(RemotePeer *peer, UserId uid);
//void processCoreSetup(QTcpSocket *socket, QVariantMap &msg);
QString setupCoreForInternalUsage();
void unregisterStorageBackend(Storage *);
bool selectBackend(const QString &backend);
void createUser();
- void changeUserPass(const QString &username);
void saveBackendSettings(const QString &backend, const QVariantMap &settings);
QVariantMap promptForSettings(const Storage *storage);
private:
QSet<CoreAuthHandler *> _connectingClients;
- QHash<UserId, SessionThread *> sessions;
+ QHash<UserId, SessionThread *> _sessions;
Storage *_storage;
QTimer _storageSyncTimer;
_quitReason = reason;
displayMsg(Message::Server, BufferInfo::StatusBuffer, "", tr("Disconnecting. (%1)").arg((!requested && !withReconnect) ? tr("Core Shutdown") : _quitReason));
- switch (socket.state()) {
- case QAbstractSocket::ConnectedState:
- userInputHandler()->issueQuit(_quitReason);
+ if (socket.state() == QAbstractSocket::UnconnectedState) {
+ socketDisconnected();
+ } else {
+ if (socket.state() == QAbstractSocket::ConnectedState) {
+ userInputHandler()->issueQuit(_quitReason);
+ } else {
+ socket.close();
+ }
if (requested || withReconnect) {
// the irc server has 10 seconds to close the socket
_socketCloseTimer.start(10000);
- break;
}
- default:
- socket.close();
- socketDisconnected();
}
}
else if (s.endsWith("\n"))
s.chop(1);
NetworkDataEvent *event = new NetworkDataEvent(EventManager::NetworkIncoming, this, s);
-#if QT_VERSION >= 0x040700
event->setTimestamp(QDateTime::currentDateTimeUtc());
-#else
- event->setTimestamp(QDateTime::currentDateTime().toUTC());
-#endif
emit newEvent(event);
}
}
disconnectFromIrc();
return;
}
-
+
emit socketOpen(identity, localAddress(), localPort(), peerAddress(), peerPort());
-
+
Server server = usedServer();
#ifdef HAVE_SSL
if (server.useSsl && !socket.isEncrypted())
return;
#endif
-#if QT_VERSION >= 0x040600
socket.setSocketOption(QAbstractSocket::KeepAliveOption, true);
-#endif
emit socketInitialized(identity, localAddress(), localPort(), peerAddress(), peerPort());
p->attachSlot(SIGNAL(createNetwork(const NetworkInfo &, const QStringList &)), this, SLOT(createNetwork(const NetworkInfo &, const QStringList &)));
p->attachSlot(SIGNAL(removeNetwork(NetworkId)), this, SLOT(removeNetwork(NetworkId)));
+ p->attachSlot(SIGNAL(changePassword(PeerPtr,QString,QString,QString)), this, SLOT(changePassword(PeerPtr,QString,QString,QString)));
+ p->attachSignal(this, SIGNAL(passwordChanged(PeerPtr,bool)));
+
loadSettings();
initScriptEngine();
net->userInputHandler()->issueAway(msg, false /* no force away */);
}
}
+
+void CoreSession::changePassword(PeerPtr peer, const QString &userName, const QString &oldPassword, const QString &newPassword)
+{
+ bool success = false;
+ UserId uid = Core::validateUser(userName, oldPassword);
+ if (uid.isValid() && uid == user())
+ success = Core::changeUserPassword(uid, newPassword);
+
+ emit passwordChanged(peer, success);
+}
#include "corecoreinfo.h"
#include "corealiasmanager.h"
#include "coreignorelistmanager.h"
+#include "peer.h"
#include "protocol.h"
#include "message.h"
#include "storage.h"
class EventStringifier;
class InternalPeer;
class IrcParser;
-class Peer;
class MessageEvent;
class NetworkConnection;
class RemotePeer;
*/
void renameBuffer(const NetworkId &networkId, const QString &newName, const QString &oldName);
+ void changePassword(PeerPtr peer, const QString &userName, const QString &oldPassword, const QString &newPassword);
+
QHash<QString, QString> persistentChannels(NetworkId) const;
//! Marks us away (or unaway) on all networks
void networkRemoved(NetworkId);
void networkDisconnected(NetworkId);
+ void passwordChanged(PeerPtr peer, bool success);
+
protected:
virtual void customEvent(QEvent *event);
QString verboseMessage = tr("sending CTCP-%1 request to %2").arg(ctcpTag).arg(nick);
if (ctcpTag == "PING") {
-#if QT_VERSION >= 0x040700
message = QString::number(QDateTime::currentMSecsSinceEpoch());
-#else
- message = QString::number(QDateTime::currentDateTime().toTime_t());
-#endif
}
// FIXME make this a proper event
}
+void CoreUserInputHandler::handlePrint(const BufferInfo &bufferInfo, const QString &msg)
+{
+ if (bufferInfo.bufferName().isEmpty() || !bufferInfo.acceptsRegularMessages())
+ return; // server buffer
+
+ QByteArray encMsg = channelEncode(bufferInfo.bufferName(), msg);
+ emit displayMsg(Message::Info, bufferInfo.type(), bufferInfo.bufferName(), msg, network()->myNick(), Message::Self);
+}
+
+
// TODO: implement queries
void CoreUserInputHandler::handleQuery(const BufferInfo &bufferInfo, const QString &msg)
{
void handleHalfop(const BufferInfo& bufferInfo, const QString &nicks);
void handlePart(const BufferInfo &bufferInfo, const QString &text);
void handlePing(const BufferInfo &bufferInfo, const QString &text);
+ void handlePrint(const BufferInfo &bufferInfo, const QString &text);
void handleQuery(const BufferInfo &bufferInfo, const QString &text);
void handleQuit(const BufferInfo &bufferInfo, const QString &text);
void handleQuote(const BufferInfo &bufferInfo, const QString &text);
if (e->ctcpType() == CtcpEvent::Query)
defaultHandler(e->ctcpCmd(), e);
else {
-#if QT_VERSION >= 0x040700
displayMsg(e, Message::Server, tr("Received CTCP-PING answer from %1 with %2 milliseconds round trip time")
.arg(nickFromMask(e->prefix())).arg(QDateTime::fromMSecsSinceEpoch(e->param().toULongLong()).msecsTo(e->timestamp())));
-#else
- displayMsg(e, Message::Server, tr("Received CTCP-PING answer from %1 with %2 seconds round trip time")
- .arg(nickFromMask(e->prefix())).arg(QDateTime::fromTime_t(e->param().toInt()).secsTo(e->timestamp())));
-#endif
}
}
markerlineitem.cpp
msgprocessorstatuswidget.cpp
nicklistwidget.cpp
+ passwordchangedlg.cpp
qtui.cpp
qtuiapplication.cpp
qtuimessageprocessor.cpp
inputwidget.ui
msgprocessorstatuswidget.ui
nicklistwidget.ui
+ passwordchangedlg.ui
settingsdlg.ui
settingspagedlg.ui
simplenetworkeditor.ui
set(LIBS )
set(QT_MODULES )
-if (KDE4_FOUND)
+if (WITH_KDE4)
add_definitions(-DHAVE_KDE ${KDE4_DEFINITIONS})
include_directories(${KDE4_INCLUDES})
list(APPEND SOURCES knotificationbackend.cpp)
list(APPEND LIBS ${KDE4_KDECORE_LIBS} ${KDE4_KDEUI_LIBRARY} ${KDE4_KNOTIFYCONFIG_LIBRARY})
endif()
+if (WITH_KF5)
+ list(APPEND SOURCES knotificationbackend.cpp)
+ list(APPEND LIBS KF5::ConfigWidgets KF5::Notifications KF5::NotifyConfig KF5::WidgetsAddons KF5::XmlGui)
+endif()
+
if (LIBSNORE_FOUND)
add_definitions(-DHAVE_LIBSNORE)
include_directories(${LIBSNORE_INCLUDE_DIRS})
res.append("<dt><b>" + person.prettyName() + "</b></dt><dd>");
if (!person.emailAddress().isEmpty())
res.append("<a href=\"mailto:" + person.emailAddress() + "\">" + person.emailAddress() + "</a><br>");
- res.append(person.task() + "</dd>");
+ res.append("<i>" + person.task() + "</i><br></dd>");
}
res.append("</dl>");
return res;
QString res;
res = tr("We would like to thank the following contributors (in alphabetical order) and everybody we forgot to mention here:") + "<br><dl>";
for (const auto &person : _aboutData->credits()) {
- res.append("<dt><b>" + person.prettyName() + "</b></dt><dd>" + person.task() + "</dd>");
+ res.append("<dt><b>" + person.prettyName() + "</b></dt><dd><i>" + person.task() + "</i><br></dd>");
}
- res.append("</dl><br>" + tr("...and anybody else finding and reporting bugs, giving feedback, helping others and being part of the community!"));
+ res.append("</dl>" + tr("...and anybody else finding and reporting bugs, giving feedback, helping others and being part of the community!"));
return res;
}
res = tr("Special thanks goes to:<br>"
"<dl>"
"<dt><img src=\":/pics/quassel-eye.png\"> <b>John \"nox\" Hand</b></dt>"
- "<dd>for the original Quassel icon - The All-Seeing Eye</dt>"
+ "<dd><i>for the original Quassel icon - The All-Seeing Eye</i><br></dt>"
"<dt><img src=\":/pics/oxygen.png\"> <b><a href=\"http://www.oxygen-icons.org\">The Oxygen Team</a></b></dt>"
- "<dd>for creating all the artwork you see throughout Quassel</dd>"
+ "<dd><i>for creating all the artwork you see throughout Quassel</i><br></dd>"
"<dt><img src=\":/pics/qt-logo-32.png\"> <b><a href=\"http://www.trolltech.com\">Qt Software formerly known as Trolltech</a></b></dt>"
- "<dd>for creating Qt and Qtopia, and for sponsoring development of QuasselTopia with Greenphones and more</dd>"
+ "<dd><i>for creating Qt and Qtopia, and for sponsoring development of QuasselTopia with Greenphones and more</i><br></dd>"
"<dt><a href=\"http://www.nokia.com\"><img src=\":/pics/nokia.png\"></a></b></dt>"
- "<dd>for keeping Qt alive, and for sponsoring development of Quassel Mobile with N810s</dd>"
+ "<dd><i>for sponsoring development of Quassel Mobile with N810s</i></dd>"
);
return res;
#ifndef CHATVIEWSEARCHCONTROLLER_H
#define CHATVIEWSEARCHCONTROLLER_H
-#include <QObject>
+#include <QGraphicsItem>
#include <QHash>
#include <QPointer>
#include <QString>
// Highlight Items
-#include <QGraphicsItem>
-
class SearchHighlightItem : public QObject, public QGraphicsItem
{
Q_OBJECT
+
+// Apparently, there are broken Qt 4.8.2 mocs around that will fail without this (otherwise useless) #if... looking at you, Wheezy!
#if QT_VERSION >= 0x040600
Q_INTERFACES(QGraphicsItem)
#endif
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
-#include <KNotification>
-#include <KNotifyConfigWidget>
+#include "knotificationbackend.h"
+
#include <QIcon>
#include <QTextDocument>
#include <QVBoxLayout>
-#include "knotificationbackend.h"
+#ifdef HAVE_KDE4
+# include <KNotification>
+# include <KNotifyConfigWidget>
+#else
+# include <KNotifications/KNotification>
+# include <KNotifyConfig/KNotifyConfigWidget>
+#endif
#include "client.h"
#include "mainwin.h"
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
-#ifndef KNOTIFICATIONBACKEND_H_
-#define KNOTIFICATIONBACKEND_H_
+#pragma once
#include <QPointer>
void removeNotificationById(uint id);
void updateToolTip();
- QList<QPair<uint, QPointer<KNotification> > > _notifications;
+ QList<QPair<uint, QPointer<KNotification>>> _notifications;
};
private:
KNotifyConfigWidget *_widget;
};
-
-
-#endif
#include <QMessageBox>
#include <QStatusBar>
#include <QToolBar>
+#include <QInputDialog>
#ifdef HAVE_KDE4
-# include <KAction>
-# include <KActionCollection>
# include <KHelpMenu>
# include <KMenuBar>
# include <KShortcutsDialog>
# include <KStatusBar>
# include <KToggleFullScreenAction>
# include <KToolBar>
-# include <KWindowSystem>
+#endif
+
+#ifdef HAVE_KF5
+# include <KConfigWidgets/KStandardAction>
+# include <KXmlGui/KHelpMenu>
+# include <KXmlGui/KShortcutsDialog>
+# include <KXmlGui/KToolBar>
+# include <KWidgetsAddons/KToggleFullScreenAction>
#endif
#ifdef Q_WS_X11
#include "legacysystemtray.h"
#include "msgprocessorstatuswidget.h"
#include "nicklistwidget.h"
+#include "passwordchangedlg.h"
#include "qtuiapplication.h"
#include "qtuimessageprocessor.h"
#include "qtuisettings.h"
#include "topicwidget.h"
#include "verticaldock.h"
-#ifndef HAVE_KDE4
+#ifndef HAVE_KDE
# ifdef HAVE_PHONON
# include "phononnotificationbackend.h"
# endif
# endif
# include "systraynotificationbackend.h"
# include "taskbarnotificationbackend.h"
-#else /* HAVE_KDE4 */
+#else /* HAVE_KDE */
# include "knotificationbackend.h"
-#endif /* HAVE_KDE4 */
+#endif /* HAVE_KDE */
#ifdef HAVE_SSL
# include "sslinfodlg.h"
#include "settingspages/notificationssettingspage.h"
#include "settingspages/topicwidgetsettingspage.h"
-#ifndef HAVE_KDE4
+#ifndef HAVE_KDE
# include "settingspages/shortcutssettingspage.h"
#endif
MainWin::MainWin(QWidget *parent)
-#ifdef HAVE_KDE4
- : KMainWindow(parent),
- _kHelpMenu(new KHelpMenu(this, KGlobal::mainComponent().aboutData())),
+#ifdef HAVE_KDE
+ : KMainWindow(parent), _kHelpMenu(new KHelpMenu(this)),
#else
: QMainWindow(parent),
#endif
setupTitleSetter();
setupHotList();
-#ifndef HAVE_KDE4
+#ifndef HAVE_KDE
# ifdef HAVE_PHONON
QtUi::registerNotificationBackend(new PhononNotificationBackend(this));
# endif
QtUi::registerNotificationBackend(new TaskbarNotificationBackend(this));
-#else /* HAVE_KDE4 */
+#else /* HAVE_KDE */
QtUi::registerNotificationBackend(new KNotificationBackend(this));
-#endif /* HAVE_KDE4 */
+#endif /* HAVE_KDE */
#ifdef HAVE_INDICATEQT
QtUi::registerNotificationBackend(new IndicatorNotificationBackend(this));
setDisconnectedState(); // Disable menus and stuff
-#ifdef HAVE_KDE4
+#ifdef HAVE_KDE
setAutoSaveSettings();
#endif
if (lastBufId.isValid())
s.setValue("LastUsedBufferId", lastBufId.toInt());
-#ifdef HAVE_KDE4
+#ifdef HAVE_KDE
saveAutoSaveSettings();
#endif
}
_normalPos = s.value("MainWinPos", pos()).toPoint();
bool maximized = s.value("MainWinMaximized", false).toBool();
-#ifndef HAVE_KDE4
+#ifndef HAVE_KDE
restoreGeometry(s.value("MainWinGeometry").toByteArray());
if (maximized) {
this, SLOT(showCoreConnectionDlg())));
coll->addAction("DisconnectCore", new Action(QIcon::fromTheme("network-disconnect"), tr("&Disconnect from Core"), coll,
Client::instance(), SLOT(disconnectFromCore())));
+ coll->addAction("ChangePassword", new Action(QIcon::fromTheme("dialog-password"), tr("Change &Password..."), coll,
+ this, SLOT(showPasswordChangeDlg())));
coll->addAction("CoreInfo", new Action(QIcon::fromTheme("help-about"), tr("Core &Info..."), coll,
this, SLOT(showCoreInfoDlg())));
coll->addAction("ConfigureNetworks", new Action(QIcon::fromTheme("configure"), tr("Configure &Networks..."), coll,
coll->addAction("ToggleStatusBar", new Action(tr("Show Status &Bar"), coll,
0, 0))->setCheckable(true);
-#ifdef HAVE_KDE4
- QAction *fullScreenAct = KStandardAction::fullScreen(this, SLOT(onFullScreenToggled()), this, coll);
+#ifdef HAVE_KDE
+ _fullScreenAction = KStandardAction::fullScreen(this, SLOT(onFullScreenToggled()), this, coll);
#else
- QAction *fullScreenAct = new Action(QIcon::fromTheme("view-fullscreen"), tr("&Full Screen Mode"), coll,
+ _fullScreenAction = new Action(QIcon::fromTheme("view-fullscreen"), tr("&Full Screen Mode"), coll,
this, SLOT(onFullScreenToggled()), QKeySequence(Qt::Key_F11));
- fullScreenAct->setCheckable(true);
+ _fullScreenAction->setCheckable(true);
+ coll->addAction("ToggleFullScreen", _fullScreenAction);
#endif
- coll->addAction("ToggleFullScreen", fullScreenAct);
// Settings
QAction *configureShortcutsAct = new Action(QIcon::fromTheme("configure-shortcuts"), tr("Configure &Shortcuts..."), coll,
configureShortcutsAct->setMenuRole(QAction::NoRole);
coll->addAction("ConfigureShortcuts", configureShortcutsAct);
- #ifdef Q_OS_MAC
+#ifdef Q_OS_MAC
QAction *configureQuasselAct = new Action(QIcon::fromTheme("configure"), tr("&Configure Quassel..."), coll,
this, SLOT(showSettingsDlg()));
configureQuasselAct->setMenuRole(QAction::PreferencesRole);
- #else
+#else
QAction *configureQuasselAct = new Action(QIcon::fromTheme("configure"), tr("&Configure Quassel..."), coll,
this, SLOT(showSettingsDlg()), QKeySequence(Qt::Key_F7));
- #endif
+#endif
coll->addAction("ConfigureQuassel", configureQuasselAct);
// Help
_fileMenu = menuBar()->addMenu(tr("&File"));
static const QStringList coreActions = QStringList()
- << "ConnectCore" << "DisconnectCore" << "CoreInfo";
+ << "ConnectCore" << "DisconnectCore" << "ChangePassword" << "CoreInfo";
QAction *coreAction;
foreach(QString actionName, coreActions) {
_viewMenu->addAction(coll->action("LockLayout"));
_settingsMenu = menuBar()->addMenu(tr("&Settings"));
-#ifdef HAVE_KDE4
+#ifdef HAVE_KDE
_settingsMenu->addAction(KStandardAction::configureNotifications(this, SLOT(showNotificationsDlg()), this));
_settingsMenu->addAction(KStandardAction::keyBindings(this, SLOT(showShortcutsDlg()), this));
#else
#endif
_settingsMenu->addAction(coll->action("ConfigureQuassel"));
+
_helpMenu = menuBar()->addMenu(tr("&Help"));
+
_helpMenu->addAction(coll->action("AboutQuassel"));
-#ifndef HAVE_KDE4
+#ifndef HAVE_KDE
_helpMenu->addAction(coll->action("AboutQt"));
#else
_helpMenu->addAction(KStandardAction::aboutKDE(_kHelpMenu, SLOT(aboutKDE()), this));
}
+void MainWin::showPasswordChangeDlg()
+{
+ if((Client::coreFeatures() & Quassel::PasswordChange)) {
+ PasswordChangeDlg dlg(this);
+ dlg.exec();
+ }
+ else {
+ QMessageBox box(QMessageBox::Warning, tr("Feature Not Supported"),
+ tr("<b>Your Quassel Core does not support this feature</b>"),
+ QMessageBox::Ok, this);
+ box.setInformativeText(tr("You need a Quassel Core v0.12.0 or newer in order to be able to remotely change your password."));
+ box.exec();
+ }
+}
+
+
void MainWin::changeActiveBufferView(bool backwards)
{
BufferView *current = activeBufferView();
void MainWin::setupViewMenuTail()
{
_viewMenu->addSeparator();
- _viewMenu->addAction(QtUi::actionCollection("General")->action("ToggleFullScreen"));
+ _viewMenu->addAction(_fullScreenAction);
}
setUnifiedTitleAndToolBarOnMac(true);
#endif
-#ifdef HAVE_KDE4
+#ifdef HAVE_KDE
_mainToolBar = new KToolBar("MainToolBar", this, Qt::TopToolBarArea, false, true, true);
#else
_mainToolBar = new QToolBar(this);
coll->action("ConnectCore")->setEnabled(false);
coll->action("DisconnectCore")->setEnabled(true);
+ coll->action("ChangePassword")->setEnabled(true);
coll->action("CoreInfo")->setEnabled(true);
foreach(QAction *action, _fileMenu->actions()) {
coll->action("ConnectCore")->setEnabled(true);
coll->action("DisconnectCore")->setEnabled(false);
coll->action("CoreInfo")->setEnabled(false);
+ coll->action("ChangePassword")->setEnabled(false);
//_viewMenu->setEnabled(false);
statusBar()->showMessage(tr("Not connected to core."));
if (_msgProcessorStatusWidget)
void MainWin::showShortcutsDlg()
{
-#ifdef HAVE_KDE4
+#ifdef HAVE_KDE
KShortcutsDialog dlg(KShortcutsEditor::AllActions, KShortcutsEditor::LetterShortcutsDisallowed, this);
foreach(KActionCollection *coll, QtUi::actionCollections())
dlg.addCollection(coll, coll->property("Category").toString());
- dlg.exec();
+ dlg.configure(true);
#else
SettingsPageDlg dlg(new ShortcutsSettingsPage(QtUi::actionCollections(), this), this);
dlg.exec();
// Relying on QWidget::isFullScreen is discouraged, see the KToggleFullScreenAction docs
// Also, one should not use showFullScreen() or showNormal(), as those reset all other window flags
- QAction *action = QtUi::actionCollection("General")->action("ToggleFullScreen");
- if (!action)
- return;
-
-#ifdef HAVE_KDE4
- KToggleFullScreenAction *kAct = static_cast<KToggleFullScreenAction *>(action);
- kAct->setFullScreen(this, kAct->isChecked());
+#ifdef HAVE_KDE
+ static_cast<KToggleFullScreenAction*>(_fullScreenAction)->setFullScreen(this, _fullScreenAction->isChecked());
#else
- if (action->isChecked())
+ if (_fullScreenAction->isChecked())
setWindowState(windowState() | Qt::WindowFullScreen);
else
setWindowState(windowState() & ~Qt::WindowFullScreen);
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
-#ifndef MAINWIN_H_
-#define MAINWIN_H_
+#pragma once
#ifdef HAVE_KDE4
# include <KMainWindow>
+#elif defined HAVE_KF5
+# include <KXmlGui/KMainWindow>
#else
# include <QMainWindow>
#endif
//!\brief The main window of Quassel's QtUi.
class MainWin
-#ifdef HAVE_KDE4
- : public KMainWindow
-{
+#ifdef HAVE_KDE
+ : public KMainWindow {
#else
-: public QMainWindow {
+ : public QMainWindow {
#endif
Q_OBJECT
void showNotificationsDlg();
void showIgnoreList(QString newRule = QString());
void showShortcutsDlg();
+ void showPasswordChangeDlg();
void showNewTransferDlg(const ClientTransfer *transfer);
void onFullScreenToggled();
void disconnectFromCore();
private:
-#ifdef HAVE_KDE4
+#ifdef HAVE_KDE
KHelpMenu *_kHelpMenu;
#endif
ChatMonitorView *_chatMonitorView;
TopicWidget *_topicWidget;
+ QAction *_fullScreenAction;
QMenu *_fileMenu, *_networksMenu, *_viewMenu, *_bufferViewsMenu, *_settingsMenu, *_helpMenu, *_helpDebugMenu;
QMenu *_toolbarMenu;
QToolBar *_mainToolBar, *_chatViewToolBar, *_nickToolBar;
friend class QtUi;
};
-
-
-#endif
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2005-2015 by the Quassel Project *
+ * devel@quassel-irc.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) version 3. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
+ ***************************************************************************/
+
+#include "passwordchangedlg.h"
+
+#include <QMessageBox>
+#include <QPushButton>
+
+#include "client.h"
+
+PasswordChangeDlg::PasswordChangeDlg(QWidget *parent) : QDialog(parent)
+{
+ ui.setupUi(this);
+
+ CoreAccount account = Client::currentCoreAccount();
+ ui.infoLabel->setText(tr("This changes the password for your username <b>%1</b> "
+ "on the Quassel Core running at <b>%2</b>.")
+ .arg(account.user(), account.hostName()));
+
+ connect(ui.oldPasswordEdit, SIGNAL(textChanged(QString)), SLOT(inputChanged()));
+ connect(ui.newPasswordEdit, SIGNAL(textChanged(QString)), SLOT(inputChanged()));
+ connect(ui.confirmPasswordEdit, SIGNAL(textChanged(QString)), SLOT(inputChanged()));
+ connect(ui.buttonBox, SIGNAL(accepted()), SLOT(changePassword()));
+
+ connect(Client::instance(), SIGNAL(passwordChanged(bool)), SLOT(passwordChanged(bool)));
+
+ ui.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
+}
+
+
+void PasswordChangeDlg::inputChanged()
+{
+ bool ok = !ui.oldPasswordEdit->text().isEmpty() && !ui.newPasswordEdit->text().isEmpty()
+ && ui.newPasswordEdit->text() == ui.confirmPasswordEdit->text();
+ ui.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(ok);
+}
+
+
+void PasswordChangeDlg::changePassword()
+{
+ ui.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
+ Client::changePassword(ui.oldPasswordEdit->text(), ui.newPasswordEdit->text());
+}
+
+
+void PasswordChangeDlg::passwordChanged(bool success)
+{
+ if (!success) {
+ QMessageBox box(QMessageBox::Warning, tr("Password Not Changed"),
+ tr("<b>Password change failed<b>"),
+ QMessageBox::Ok, this);
+ box.setInformativeText(tr("The core reported an error when trying to change your password. Make sure you entered your old password correctly!"));
+ box.exec();
+ }
+ else {
+ accept();
+ }
+}
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2005-2015 by the Quassel Project *
+ * devel@quassel-irc.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) version 3. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
+ ***************************************************************************/
+
+#pragma once
+
+#include <QDialog>
+
+#include "ui_passwordchangedlg.h"
+
+class PasswordChangeDlg : public QDialog
+{
+ Q_OBJECT
+
+public:
+ PasswordChangeDlg(QWidget *parent = nullptr);
+
+private slots:
+ void inputChanged();
+ void changePassword();
+ void passwordChanged(bool success);
+
+private:
+ Ui::PasswordChangeDlg ui;
+ QString _newPassword;
+};
#include "qtui.h"
#include "qtuisettings.h"
+
QtUiApplication::QtUiApplication(int &argc, char **argv)
#ifdef HAVE_KDE4
- : KApplication(),
+ : KApplication(), // KApplication is deprecated in KF5
#else
: QApplication(argc, argv),
#endif
#ifdef HAVE_KDE4
Q_UNUSED(argc); Q_UNUSED(argv);
- // We need to setup KDE's data dirs
+ // Setup KDE's data dirs
+ // Because we can't use KDE stuff in (the class) Quassel directly, we need to do this here...
QStringList dataDirs = KGlobal::dirs()->findDirs("data", "");
+
+ // Just in case, also check our install prefix
+ dataDirs << QCoreApplication::applicationDirPath() + "/../share/apps/";
+
+ // Normalize and append our application name
for (int i = 0; i < dataDirs.count(); i++)
- dataDirs[i].append("quassel/");
+ dataDirs[i] = QDir::cleanPath(dataDirs.at(i)) + "/quassel/";
+
+ // Add resource path and just in case.
+ // Workdir should have precedence
+ dataDirs.prepend(QCoreApplication::applicationDirPath() + "/data/");
dataDirs.append(":/data/");
+
+ // Append trailing '/' and check for existence
+ auto iter = dataDirs.begin();
+ while (iter != dataDirs.end()) {
+ if (!iter->endsWith(QDir::separator()) && !iter->endsWith('/'))
+ iter->append(QDir::separator());
+ if (!QFile::exists(*iter))
+ iter = dataDirs.erase(iter);
+ else
+ ++iter;
+ }
+
+ dataDirs.removeDuplicates();
setDataDirPaths(dataDirs);
#else /* HAVE_KDE4 */
: SettingsPage(tr("Remote Cores"), tr("Connection"), parent)
{
ui.setupUi(this);
-#ifndef HAVE_KDE4
- ui.useSolid->hide();
-#endif
initAutoWidgets();
- connect(ui.useSolid, SIGNAL(toggled(bool)), SLOT(widgetHasChanged()));
connect(ui.useQNetworkConfigurationManager, SIGNAL(toggled(bool)), SLOT(widgetHasChanged()));
connect(ui.usePingTimeout, SIGNAL(toggled(bool)), SLOT(widgetHasChanged()));
connect(ui.useNoTimeout, SIGNAL(toggled(bool)), SLOT(widgetHasChanged()));
void CoreConnectionSettingsPage::defaults()
{
-#ifdef HAVE_KDE4
- setRadioButtons(CoreConnectionSettings::UseSolid);
-#else
setRadioButtons(CoreConnectionSettings::UseQNetworkConfigurationManager);
-#endif
SettingsPage::defaults();
}
void CoreConnectionSettingsPage::setRadioButtons(CoreConnectionSettings::NetworkDetectionMode mode)
{
switch (mode) {
-#ifdef HAVE_KDE4
- case CoreConnectionSettings::UseSolid:
- ui.useSolid->setChecked(true);
- break;
-#endif
case CoreConnectionSettings::UseQNetworkConfigurationManager:
ui.useQNetworkConfigurationManager->setChecked(true);
break;
CoreConnectionSettings::NetworkDetectionMode CoreConnectionSettingsPage::modeFromRadioButtons() const
{
-#ifdef HAVE_KDE4
- if (ui.useSolid->isChecked())
- return CoreConnectionSettings::UseSolid;
-#endif
if (ui.useQNetworkConfigurationManager->isChecked())
return CoreConnectionSettings::UseQNetworkConfigurationManager;
if (ui.usePingTimeout->isChecked())
<rect>
<x>0</x>
<y>0</y>
- <width>446</width>
+ <width>476</width>
<height>465</height>
</rect>
</property>
<string>Network Status Detection</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="QRadioButton" name="useSolid">
- <property name="toolTip">
- <string>Rely on KDE's hardware layer to detect if we're online. Recommended for most KDE users</string>
- </property>
- <property name="text">
- <string>Use KDE's network status detection (via Solid)</string>
- </property>
- <property name="checked">
- <bool>false</bool>
- </property>
- </widget>
- </item>
<item>
<widget class="QRadioButton" name="useQNetworkConfigurationManager">
<property name="toolTip">
- <string>Rely on Qt's network configuration manager to detect if we're online.</string>
+ <string>Rely on Qt's network configuration manager to detect if we're online</string>
</property>
<property name="text">
- <string>Use Qt's network status detection (via QNetworkConfigurationManager)</string>
+ <string>Automatic</string>
</property>
<property name="checked">
<bool>false</bool>
<item>
<widget class="QSpinBox" name="reconnectInterval">
<property name="toolTip">
- <string>Actively ping the remote core and disconnect if we didn't get a reply after a certain time</string>
+ <string>Interval between consecutive connection attempts</string>
</property>
<property name="suffix">
<string> seconds</string>
</item>
</layout>
</widget>
+ <tabstops>
+ <tabstop>useQNetworkConfigurationManager</tabstop>
+ <tabstop>usePingTimeout</tabstop>
+ <tabstop>pingTimeout</tabstop>
+ <tabstop>useNoTimeout</tabstop>
+ <tabstop>autoReconnect</tabstop>
+ <tabstop>reconnectInterval</tabstop>
+ </tabstops>
<resources/>
<connections>
<connection>
NotificationSettings notificationSettings;
notificationSettings.setHighlightList(highlightList);
- NotificationSettings::HighlightNickType highlightNickType;
- if (ui.highlightNoNick->isChecked())
- highlightNickType = NotificationSettings::NoNick;
+ NotificationSettings::HighlightNickType highlightNickType = NotificationSettings::NoNick;
if (ui.highlightCurrentNick->isChecked())
highlightNickType = NotificationSettings::CurrentNick;
if (ui.highlightAllNicks->isChecked())
{
NotificationSettings notificationSettings;
- NotificationSettings::HighlightNickType highlightNickType;
- if (ui.highlightNoNick->isChecked())
- highlightNickType = NotificationSettings::NoNick;
+ NotificationSettings::HighlightNickType highlightNickType = NotificationSettings::NoNick;
if (ui.highlightCurrentNick->isChecked())
highlightNickType = NotificationSettings::CurrentNick;
if (ui.highlightAllNicks->isChecked())
highlightNickType = NotificationSettings::AllNicks;
- if (notificationSettings.highlightNick() != highlightNickType) return true;
- if (notificationSettings.nicksCaseSensitive() != ui.nicksCaseSensitive->isChecked()) return true;
-
- if (notificationSettings.highlightList() != highlightList) return true;
+ if (notificationSettings.highlightNick() != highlightNickType)
+ return true;
+ if (notificationSettings.nicksCaseSensitive() != ui.nicksCaseSensitive->isChecked())
+ return true;
+ if (notificationSettings.highlightList() != highlightList)
+ return true;
return false;
}
ui.setupUi(this);
ui.useSSL->setIcon(QIcon::fromTheme("document-encrypt"));
ui.host->setText(server.host);
+ ui.host->setFocus();
ui.port->setValue(server.port);
ui.password->setText(server.password);
ui.useSSL->setChecked(server.useSsl);
virtual QString iconNameForAction(QAction *action) // TODO Qt 4.7: fixme when we have converted our iconloader
{
QIcon icon(action->icon());
-#if QT_VERSION >= 0x040701
- // QIcon::name() is in the 4.7 git branch, but it is not in 4.7 TP.
- // If you get a build error here, you need to update your pre-release
- // of Qt 4.7.
return icon.isNull() ? QString() : icon.name();
-#else
- return QString();
-#endif
}
};
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>PasswordChangeDlg</class>
+ <widget class="QDialog" name="PasswordChangeDlg">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>455</width>
+ <height>173</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Change Password</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QLabel" name="infoLabel">
+ <property name="text">
+ <string notr="true"><html><head/><body><p>This changes the password for your username <span style=" font-weight:600;">John</span> on the Quassel Core running at <span style=" font-weight:600;">example.invalid</span>.</p></body></html></string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QFormLayout" name="formLayout">
+ <item row="0" column="0">
+ <widget class="QLabel" name="oldPasswordLabel">
+ <property name="text">
+ <string>Old password:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QLineEdit" name="oldPasswordEdit">
+ <property name="echoMode">
+ <enum>QLineEdit::Password</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="newPasswordLabel">
+ <property name="text">
+ <string>New Password:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QLineEdit" name="newPasswordEdit">
+ <property name="echoMode">
+ <enum>QLineEdit::Password</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="confirmPasswordLabel">
+ <property name="text">
+ <string>Confirm password:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QLineEdit" name="confirmPasswordEdit">
+ <property name="echoMode">
+ <enum>QLineEdit::Password</enum>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </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>
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>rejected()</signal>
+ <receiver>PasswordChangeDlg</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>248</x>
+ <y>152</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>229</x>
+ <y>-14</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
endif()
if (WITH_KF5)
- target_link_libraries(mod_uisupport KF5::CoreAddons KF5::TextWidgets)
+ target_link_libraries(mod_uisupport KF5::CoreAddons KF5::TextWidgets KF5::XmlGui)
endif()
{ "Bruno Patri", "", tr("French translation"), "", QLocale::French },
{ "Celeste Paul", "seele", tr("Usability review") },
{ "Chris Fuenty", "stitch", tr("SASL support") },
- { "Chris H", "Zren", tr("Various improvements") },
+ { "Chris Holland", "Shade / Zren", tr("Various improvements") },
{ "Chris Le Sueur", "Fish-Face", tr("Various fixes and improvements") },
{ "Chris Moeller", "kode54", tr("Various fixes and improvements") },
{ "", "Condex", tr("Galician translation"), "", QLocale::Galician },
{ "Jussi Schultink", "jussi01", tr("Tireless tester, {Ku|U}buntu tester and lobbyist, liters of delicious Finnish alcohol") },
{ "K. Ernest Lee", "iFire", tr("Qt5 porting help, Travis CI setup") },
{ "Kevin Funk", "KRF", tr("German translation"), "", QLocale::German },
+ { "Kimmo Huoman", "kipe", tr("Buffer merge improvements") },
{ "", "Larso", tr("Finnish translation"), "", QLocale::Finnish },
{ "Lasse Liehu", "", tr("Finnish translation"), "", QLocale::Finnish },
{ "Leo Franchi", "", tr("OSX improvements") },
{ "Pavel Volkovitskiy", "int", tr("Early beta tester and bughunter") },
{ "Per Nielsen", "", tr("Danish translation"), "", QLocale::Danish },
{ "Pete Beardmore", "elbeardmorez", tr("Linewrap for input line") },
+ { "Pierre-Hugues Husson", "", tr("/print command") },
{ "Ramanathan Sivagurunathan", "", tr("Bugfixes") },
{ "Regis Perrin", "ZRegis", tr("French translation"), "", QLocale::French },
{ "Rolf Eike Beer", "", tr("Build system fixes") },
* Parts of this implementation are based on KDE's KActionCollection. *
***************************************************************************/
-#ifndef HAVE_KDE4
+#ifndef HAVE_KDE
#include <QAction>
#include <QDebug>
}
-#endif /* HAVE_KDE4 */
+#endif /* HAVE_KDE */
* This is a subset of the API of KDE's KActionCollection. *
***************************************************************************/
-#ifndef ACTIONCOLLECTION_H_
-#define ACTIONCOLLECTION_H_
+#pragma once
-#ifndef HAVE_KDE4
+#ifndef HAVE_KDE
#include <QDebug>
#include <QList>
int ActionCollection::count() const { return actions().count(); }
bool ActionCollection::isEmpty() const { return actions().count(); }
-#else /* HAVE_KDE4 */
-
-#include <KActionCollection>
+#else /* HAVE_KDE */
+# ifdef HAVE_KDE4
+# include <KActionCollection>
+# else
+# include <KXmlGui/KActionCollection>
+# endif
class ActionCollection : public KActionCollection
{
explicit ActionCollection(QObject *parent) : KActionCollection(parent) {};
};
-
-#endif
-
-#endif
+#endif /* HAVE_KDE */
if (bufferList.count() != 1)
return QTreeView::dropEvent(event);
- NetworkId networkId = bufferList[0].first;
BufferId bufferId2 = bufferList[0].second;
if (index.data(NetworkModel::ItemTypeRole) != NetworkModel::BufferItemType)
if (index.data(NetworkModel::BufferTypeRole) != BufferInfo::QueryBuffer)
return QTreeView::dropEvent(event);
- if (index.data(NetworkModel::NetworkIdRole).value<NetworkId>() != networkId)
- return QTreeView::dropEvent(event);
-
BufferId bufferId1 = index.data(NetworkModel::BufferIdRole).value<BufferId>();
if (bufferId1 == bufferId2)
return QTreeView::dropEvent(event);
registerAction(BufferRemove, tr("Delete Chat(s)..."));
registerAction(BufferSwitchTo, tr("Go to Chat"));
+ registerAction(HideJoinPartQuit, tr("Joins/Parts/Quits"));
registerAction(HideJoin, tr("Joins"), true);
registerAction(HidePart, tr("Parts"), true);
registerAction(HideQuit, tr("Quits"), true);
registerAction(ShowIgnoreList, tr("Show Ignore List"));
QMenu *hideEventsMenu = new QMenu();
+ hideEventsMenu->addAction(action(HideJoinPartQuit));
+ hideEventsMenu->addSeparator();
hideEventsMenu->addAction(action(HideJoin));
hideEventsMenu->addAction(action(HidePart));
hideEventsMenu->addAction(action(HideQuit));
row++;
}
- Q_ASSERT(topLeftItem && bottomRightItem); // there should be one range left.
- sourceSelection << QItemSelectionRange(mapToSource(createIndex(topLeftItem->pos(), left, topLeftItem)), mapToSource(createIndex(bottomRightItem->pos(), right, bottomRightItem)));
+ if (topLeftItem && bottomRightItem) { // there should be one range left.
+ sourceSelection << QItemSelectionRange(mapToSource(createIndex(topLeftItem->pos(), left, topLeftItem)), mapToSource(createIndex(bottomRightItem->pos(), right, bottomRightItem)));
+ }
}
return sourceSelection;
}
+// NOTE: Window activation stuff seems to work just fine in Plasma 5 without requiring X11 hacks.
+// TODO: Evaluate cleaning all this up once we can get rid of Qt4/KDE4
+
// Code taken from KStatusNotifierItem for handling minimize/restore
bool GraphicalUi::checkMainWidgetVisibility(bool perform)
cursor.clearSelection();
}
- if (color) {
- color = false;
+
+ if (color)
mircText.append('\x03');
- }
- if (underline) {
- underline = false;
+
+ if (underline)
mircText.append('\x1f');
- }
- if (italic) {
- italic = false;
+
+ if (italic)
mircText.append('\x1d');
- }
- if (bold) {
- bold = false;
+
+ if (bold)
mircText.append('\x02');
- }
return mircText;
}
{
Q_UNUSED(action)
+ if (type == HideJoinPartQuit) {
+ bool anyChecked = NetworkModelController::action(HideJoin)->isChecked();
+ anyChecked |= NetworkModelController::action(HidePart)->isChecked();
+ anyChecked |= NetworkModelController::action(HideQuit)->isChecked();
+
+ // If any are checked, uncheck them all.
+ // If none are checked, check them all.
+ bool newCheckedState = !anyChecked;
+ NetworkModelController::action(HideJoin)->setChecked(newCheckedState);
+ NetworkModelController::action(HidePart)->setChecked(newCheckedState);
+ NetworkModelController::action(HideQuit)->setChecked(newCheckedState);
+ }
+
int filter = 0;
if (NetworkModelController::action(HideJoin)->isChecked())
filter |= Message::Join | Message::NetsplitJoin;
filter |= Message::Topic;
switch (type) {
+ case HideJoinPartQuit:
case HideJoin:
case HidePart:
case HideQuit:
HideMode = 0x0500,
HideDayChange = 0x0600,
HideTopic = 0x0700,
+ HideJoinPartQuit = 0xd00,
HideUseDefaults = 0xe00,
HideApplyToAll = 0xf00,
QString styleSheet;
styleSheet += loadStyleSheet("file:///" + Quassel::findDataFilePath("stylesheets/default.qss"));
styleSheet += loadStyleSheet("file:///" + Quassel::configDirPath() + "settings.qss");
- if (s.value("UseCustomStyleSheet", false).toBool())
- styleSheet += loadStyleSheet("file:///" + s.value("CustomStyleSheetPath").toString(), true);
+ if (s.value("UseCustomStyleSheet", false).toBool()) {
+ QString customSheetPath(s.value("CustomStyleSheetPath").toString());
+ QString customSheet = loadStyleSheet("file:///" + customSheetPath, true);
+ if (customSheet.isEmpty()) {
+ // MIGRATION: changed default install path for data from /usr/share/apps to /usr/share
+ if (customSheetPath.startsWith("/usr/share/apps/quassel")) {
+ customSheetPath.replace(QRegExp("^/usr/share/apps"), "/usr/share");
+ customSheet = loadStyleSheet("file:///" + customSheetPath, true);
+ if (!customSheet.isEmpty()) {
+ s.setValue("CustomStyleSheetPath", customSheetPath);
+ qDebug() << "Custom stylesheet path migrated to" << customSheetPath;
+ }
+ }
+ }
+ styleSheet += customSheet;
+ }
styleSheet += loadStyleSheet("file:///" + Quassel::optionValue("qss"), true);
if (!styleSheet.isEmpty()) {