Skip to content

Commit

Permalink
Use linux icon theme
Browse files Browse the repository at this point in the history
Signed-off-by: Loïc Escales L0L022@openmailbox.org (github: L0L022)
  • Loading branch information
Escales Loïc committed Dec 24, 2015
1 parent 3e3e3cf commit a6e82cf
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Telegram/SourceFiles/pspecific_linux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ namespace {
};

PsMainWindow::PsMainWindow(QWidget *parent) : QMainWindow(parent),
posInited(false), trayIcon(0), trayIconMenu(0), icon256(qsl(":/gui/art/icon256.png")), iconbig256(icon256), wndIcon(QPixmap::fromImage(icon256, Qt::ColorOnly)), _psCheckStatusIconLeft(100), _psLastIndicatorUpdate(0) {
posInited(false), trayIcon(0), trayIconMenu(0), icon256(qsl(":/gui/art/icon256.png")), iconbig256(icon256), wndIcon(QIcon::fromTheme("telegram", QIcon(QPixmap::fromImage(icon256, Qt::ColorOnly)))), _psCheckStatusIconLeft(100), _psLastIndicatorUpdate(0) {
connect(&_psCheckStatusIconTimer, SIGNAL(timeout()), this, SLOT(psStatusIconCheck()));
_psCheckStatusIconTimer.setSingleShot(false);

Expand Down Expand Up @@ -1172,13 +1172,15 @@ void psRegisterCustomScheme() {
DEBUG_LOG(("App Info: placing .desktop file"));
if (QDir(home + qsl(".local/")).exists()) {
QString apps = home + qsl(".local/share/applications/");
QString icons = home + qsl(".local/share/icons/");
if (!QDir(apps).exists()) QDir().mkpath(apps);
if (!QDir(icons).exists()) QDir().mkpath(icons);

QString path = cWorkingDir() + qsl("tdata/"), file = path + qsl("telegramdesktop.desktop");
QDir().mkpath(path);
QFile f(file);
if (f.open(QIODevice::WriteOnly)) {
QString icon = path + qsl("icon.png");
QString icon = icons + qsl("telegram.png");
if (!QFile(icon).exists()) {
if (QFile(qsl(":/gui/art/icon256.png")).copy(icon)) {
DEBUG_LOG(("App Info: Icon copied to 'tdata'"));
Expand All @@ -1194,7 +1196,7 @@ void psRegisterCustomScheme() {
s << "Name=Telegram Desktop\n";
s << "Comment=Official desktop version of Telegram messaging app\n";
s << "Exec=" << escapeShell(cExeDir() + cExeName()) << " -- %u\n";
s << "Icon=" << icon << "\n";
s << "Icon=telegram\n";
s << "Terminal=false\n";
s << "StartupWMClass=Telegram\n";
s << "Type=Application\n";
Expand Down

0 comments on commit a6e82cf

Please sign in to comment.