Skip to content

Commit

Permalink
Merge branch 'master' into webengine
Browse files Browse the repository at this point in the history
  • Loading branch information
Ri0n committed Apr 17, 2017
2 parents 964039c + 45580c7 commit 4b1da2c
Show file tree
Hide file tree
Showing 19 changed files with 1,187 additions and 765 deletions.
2 changes: 1 addition & 1 deletion iris
Submodule iris updated 1 files
+1 −1 src/jdns/src/jdns/CMakeLists.txt
2 changes: 2 additions & 0 deletions options/default.xml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@
</avatars>
<alert-for-already-open-chats type="bool">true</alert-for-already-open-chats>
<auto-popup type="bool">false</auto-popup>
<auto-capitalize type="bool">false</auto-capitalize>
<delete-contents-after type="QString">hour</delete-contents-after>
<raise-chat-windows-on-new-messages type="bool">false</raise-chat-windows-on-new-messages>
<switch-tab-on-new-messages type="bool">false</switch-tab-on-new-messages>
Expand Down Expand Up @@ -467,6 +468,7 @@
<show-messageFirst type="QKeySequence" comment="Show first message" >Alt+End</show-messageFirst>
<show-messageNext type="QKeySequence" comment="Show next message" >Ctrl+Down</show-messageNext>
<show-messagePrev type="QKeySequence" comment="Show prev message" >Ctrl+Up</show-messagePrev>
<change-case type="QKeySequence" comment="Change case of letters in the chat edit" >Ctrl+Alt+x</change-case>
</chat>
<contactlist comment="Shortcuts in the contactlist">
<assign-custom-avatar type="QKeySequence" comment="Assign a custom avatar to the selected contact"/>
Expand Down
11 changes: 6 additions & 5 deletions src/actionlist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public slots:
void actionDestroyed(QObject *);
};

ActionList::ActionList( QString name, int id, bool autoDelete )
ActionList::ActionList( const QString &name, int id, bool autoDelete )
: QObject()
{
d = new Private();
Expand All @@ -65,6 +65,8 @@ ActionList::ActionList( const ActionList &from )

ActionList::~ActionList()
{
if (d->autoDeleteActions)
qDeleteAll(d->actions);
delete d;
}

Expand All @@ -78,7 +80,7 @@ int ActionList::id() const
return d->id;
}

IconAction *ActionList::action( QString name ) const
IconAction *ActionList::action( const QString &name ) const
{
return d->actions[name];
}
Expand All @@ -88,7 +90,7 @@ QStringList ActionList::actions() const
return d->sortedActions;
}

void ActionList::addAction( QString name, IconAction *action )
void ActionList::addAction( const QString &name, IconAction *action )
{
d->sortedActions << name;

Expand Down Expand Up @@ -148,7 +150,7 @@ MetaActionList::~MetaActionList()
delete d;
}

ActionList *MetaActionList::actionList( QString name ) const
ActionList *MetaActionList::actionList( const QString &name ) const
{
foreach(ActionList* a, d->lists) {
if (a->name() == name)
Expand Down Expand Up @@ -208,7 +210,6 @@ void MetaActionList::addList( ActionList *list )

void MetaActionList::clear()
{

foreach(ActionList* l, d->lists) {
l->clear();
}
Expand Down
8 changes: 4 additions & 4 deletions src/actionlist.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,17 @@ class ActionList : public QObject
{
Q_OBJECT
public:
ActionList(QString name, int id, bool autoDelete = true);
ActionList(const QString &name, int id, bool autoDelete = true);
ActionList(const ActionList &);
~ActionList();

QString name() const;
int id() const;

IconAction *action( QString name ) const;
IconAction *action( const QString &name ) const;
QStringList actions() const;

void addAction( QString name, IconAction *action );
void addAction( const QString &name, IconAction *action );

void clear();

Expand All @@ -59,7 +59,7 @@ class MetaActionList : public QObject
MetaActionList();
~MetaActionList();

ActionList *actionList( QString name ) const;
ActionList *actionList( const QString &name ) const;
QList<ActionList*> actionLists( int id ) const;
QStringList actionLists() const;

Expand Down
31 changes: 23 additions & 8 deletions src/applicationinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include <QStandardPaths>
#endif

#ifdef HAVE_X11
#ifdef Q_OS_UNIX
#include <sys/stat.h> // chmod
#endif

Expand All @@ -36,6 +36,9 @@
#include "config.h"
#endif

#define xstr(a) str(a)
#define str(a) #a

// Constants. These should be moved to a more 'dynamically changeable'
// place (like an external file loaded through the resources system)
// Should also be overridable through an optional file.
Expand All @@ -58,11 +61,6 @@
#define PROG_APPCAST_URL ""
#endif

#if defined(HAVE_X11) && !defined(PSI_DATADIR)
#define PSI_DATADIR "/usr/local/share/psi"
#endif


QString ApplicationInfo::name()
{
return PROG_NAME;
Expand Down Expand Up @@ -141,7 +139,7 @@ QString ApplicationInfo::getCertificateStoreSaveDir()

QString ApplicationInfo::resourcesDir()
{
#if defined(HAVE_X11)
#if defined(Q_OS_UNIX)
return PSI_DATADIR;
#elif defined(Q_OS_WIN)
return qApp->applicationDirPath();
Expand Down Expand Up @@ -238,10 +236,16 @@ QString ApplicationInfo::homeDir(ApplicationInfo::HomedirType type)
QDir configDir(QDir::homePath() + "/Library/Application Support/" + name());
QDir cacheDir(QDir::homePath() + "/Library/Caches/" + name());
QDir dataDir(configDir);
#elif defined HAVE_X11
#elif defined HAVE_FREEDESKTOP
#ifndef HAVE_QT5
QString XdgConfigHome = QString::fromLocal8Bit(getenv("XDG_CONFIG_HOME"));
QString XdgDataHome = QString::fromLocal8Bit(getenv("XDG_DATA_HOME"));
QString XdgCacheHome = QString::fromLocal8Bit(getenv("XDG_CACHE_HOME"));
#else
QString XdgConfigHome(QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation));
QString XdgDataHome(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation));
QString XdgCacheHome(QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation));
#endif
if (XdgConfigHome.isEmpty()) {
XdgConfigHome = QDir::homePath() + "/.config";
}
Expand Down Expand Up @@ -383,3 +387,14 @@ QString ApplicationInfo::currentProfileDir(ApplicationInfo::HomedirType type)
{
return pathToProfile(activeProfile, type);
}

QString ApplicationInfo::desktopFile()
{
QString dFile;
const QString _desktopFile(xstr(APP_PREFIX) "/share/applications/" xstr(APP_BIN_NAME) ".desktop");
QFile f(_desktopFile);
if(f.open(QIODevice::ReadOnly)) {
dFile = QString::fromUtf8(f.readAll());
}
return dFile;
}
3 changes: 3 additions & 0 deletions src/applicationinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ class ApplicationInfo
static QString optionsNS();
static QString storageNS();
static QString fileCacheNS();

// Common
static QString desktopFile();
};

#endif
Loading

0 comments on commit 4b1da2c

Please sign in to comment.