| 1 |
/* |
| 2 |
* Copyright (C) 2013 National University of Defense Technology(NUDT) & Kylin Ltd. |
| 3 |
* |
| 4 |
* Authors: |
| 5 |
* lenky gao [email protected]/[email protected] |
| 6 |
* |
| 7 |
* This program is free software; you can redistribute it and/or modify |
| 8 |
* it under the terms of the GNU General Public License as published by |
| 9 |
* the Free Software Foundation; version 3. |
| 10 |
* |
| 11 |
* This program is distributed in the hope that it will be useful, |
| 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 |
* GNU General Public License for more details. |
| 15 |
* |
| 16 |
* You should have received a copy of the GNU General Public License |
| 17 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 18 |
*/ |
| 19 |
|
| 20 |
#include <QDebug> |
| 21 |
#include <QDir> |
| 22 |
|
| 23 |
#include <fcitx-config/fcitx-config.h> |
| 24 |
|
| 25 |
#include "skinmenu.h" |
| 26 |
#include "mainwindow.h" |
| 27 |
#include "skinfcitx.h" |
| 28 |
#include "main_model.h" |
| 29 |
|
| 30 |
|
| 31 |
SkinMenu::SkinMenu(const QString &title, QWidget *parent) |
| 32 |
: QMenu(title, parent) |
| 33 |
{ |
| 34 |
triggerUpdateSkinListMenu(); |
| 35 |
|
| 36 |
QObject::connect(this, SIGNAL(aboutToShow()), this, |
| 37 |
SLOT(triggerUpdateSkinListMenu())); |
| 38 |
|
| 39 |
QObject::connect(this, SIGNAL(triggered(QAction*)), this, |
| 40 |
SLOT(menuItemOnClick(QAction *))); |
| 41 |
} |
| 42 |
|
| 43 |
SkinMenu::~SkinMenu() |
| 44 |
{ |
| 45 |
|
| 46 |
} |
| 47 |
|
| 48 |
void SkinMenu::triggerUpdateSkinListMenu() |
| 49 |
{ |
| 50 |
int i; |
| 51 |
QDir skinDir; |
| 52 |
QFileInfoList list; |
| 53 |
QFileInfoList::Iterator iter; |
| 54 |
|
| 55 |
this->clear(); |
| 56 |
|
| 57 |
char* ukSkinPath = getQimpanelSharePath("uk-default-skin"); |
| 58 |
for (i = 0; i < 1; i ++) { |
| 59 |
skinDir = QDir(ukSkinPath); |
| 60 |
if (!skinDir.exists()) |
| 61 |
continue; |
| 62 |
|
| 63 |
skinDir.setFilter(QDir::Dirs); |
| 64 |
list = skinDir.entryInfoList(); |
| 65 |
for (iter = list.begin(); iter != list.end(); ++ iter) { |
| 66 |
if (iter->isDir() && "." != iter->fileName() && ".." != iter->fileName()) { |
| 67 |
QFile fcitxSkinConfFile(iter->absoluteFilePath() + "/fcitx_skin.conf"); |
| 68 |
if (!fcitxSkinConfFile.exists()) |
| 69 |
continue; |
| 70 |
|
| 71 |
|
| 72 |
} |
| 73 |
} |
| 74 |
} |
| 75 |
} |
| 76 |
|