youker-assistant-3.0.2/ 0000775 0001750 0001750 00000000000 14034030554 013461 5 ustar feng feng youker-assistant-3.0.2/dbusproxy/ 0000775 0001750 0001750 00000000000 13600302431 015512 5 ustar feng feng youker-assistant-3.0.2/dbusproxy/youkersystemdbus.h 0000664 0001750 0001750 00000011156 13600302431 021330 0 ustar feng feng /*
* Copyright (C) 2013 ~ 2015 National University of Defense Technology(NUDT) & Kylin Ltd.
*
* Authors:
* Kobe Lee xiangli@ubuntukylin.com/kobe24_lixiang@126.com
*
* 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; 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, see .
*/
#ifndef YOUKERSYSTEMDBUS_H
#define YOUKERSYSTEMDBUS_H
#include
#include
#include
//#include "kthread.h"
class SystemDispatcher : public QObject
{
Q_OBJECT
public:
explicit SystemDispatcher(QObject *parent = 0);
~SystemDispatcher();
//退出systemdbus服务
void exit_qt();
void adjust_cpufreq_scaling_governer_qt(QString value);
QStringList get_cpufreq_scaling_governer_list_qt();
QString get_current_cpufreq_scaling_governer_qt();
void cleanAllSelectItems(QMap selectMap);
bool kill_uk_process_qt();
//杀掉root用户的进程
// void kill_root_process_qt(QString pid);
//得到SystemDbus的验证值,可以通过其判断该服务是否正在运行
QString get_system_daemon_qt();
//为系统设置来设置登录系统的普通用户的用户目录
// void set_homedir_qt();
//为系统清理来设置登录系统的普通用户的用户目录
void set_user_homedir_qt();
//首页一键清理
void clean_by_main_one_key_qt();
bool copy_file_qt(QString filename);
bool delete_file_qt(QString filename);
bool update_myself();
bool update_source();
//-----------------------sound------------------------
QStringList get_sound_themes_qt();
// Q_INVOKABLE QStringList get_sounds_qt();
// Q_INVOKABLE void replace_sound_file_qt(QString origfile, QString targetfile);
// Q_INVOKABLE void restore_sound_file_qt(QString targetfile);
// Q_INVOKABLE void restore_all_sound_file_qt(QString soundtheme);
bool set_cursor_theme_with_root_qt(QString theme);
//-----------------------others------------------------
void custom_plymouth_bg_qt(QString plymouthName);
void add_new_plymouth_qt(QString customBG, QString plymouthName);
QStringList get_existing_plymouth_list_qt();
void plymouth_init_check_qt();
QString get_image_path_qt(QString name);
QString delete_plymouth_qt(QString plymouthName);
//得到当前系统和桌面的详细信息
QString get_os_name_qt();
bool judge_sensors_exists_qt();
QMap get_computer_info_qt();
QMap get_sensor_info_qt();
QMap get_cpu_info_qt();
QMap get_memory_info_qt();
QMap get_board_info_qt();
QMap get_harddisk_info_qt();
QMap get_networkcard_info_qt();
QMap get_monitor_info_qt();
QMap get_cdrom_info_qt();
QMap get_audiocard_info_qt();
QString get_time_value_qt();
signals:
void tellCleanerMainData(const QStringList &data);
void tellCleanerMainStatus(const QString &status, const QString &domain);
void sendCleanOverSignal();
void sendCleanErrorSignal(const QString &status);
void policykitCleanSignal(bool status);
void finishCleanWorkMain(QString msg);
void finishCleanWorkMainError(QString msg);
void quickCleanProcess(QString type, QString status);
//apt
void get_fetch_signal(QString msg_type, QStringList msg);
void get_apt_signal(QString msg_type, QStringList msg);
// void dbusInitFinished();
public slots:
void handler_interrupt_clean(bool status);
void handler_clear_rubbish_main_onekey(QString msg);
void handler_clear_rubbish_main_error(QString msg);
void handler_status_for_quick_clean(QString type, QString status);
void handlerCleanerSubPageDataSignal(QStringList data);
void handlerCleanerSubPageStatusSignal(QString status, QString domain);
void handlerCleanerSubPageErrorSignal(QString status);
//apt
// void handlerFetchSignal(QString msg_type, QStringList msg);
// void handlerAptSignal(QString msg_type, QStringList msg);
private:
QDBusInterface *systemiface;
// KThread *thread;
// KThread *clean_thread;
};
#endif // YOUKERSYSTEMDBUS_H
youker-assistant-3.0.2/dbusproxy/youkersessiondbus.h 0000664 0001750 0001750 00000033275 13600302431 021475 0 ustar feng feng /*
* Copyright (C) 2013 ~ 2015 National University of Defense Technology(NUDT) & Kylin Ltd.
*
* Authors:
* Kobe Lee xiangli@ubuntukylin.com/kobe24_lixiang@126.com
*
* 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; 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, see .
*/
#ifndef SESSIONDISPATCHER_H
#define SESSIONDISPATCHER_H
#include
#include
#include
#include
//#include "kthread.h"
class SessionDispatcher : public QObject
{
Q_OBJECT
public:
explicit SessionDispatcher(QObject *parent = 0);
~SessionDispatcher();
void getAutoStartAppStatus();
bool getSingleAutoStartStatus(QString abs_path);
void changeAutoStartAppStatus(QString appName);
QStringList checkNewVersion();
void runApp(QString pkgname);
void scanSystemCleanerItems(QMap data);
void check_user_qt();
//打开文件夹
void open_folder_qt(QString path);
// bool judge_camera_qt();
// void call_camera_qt();
QMap batteryInfo;
bool judge_power_is_exists_qt();
QMap read_battery_info_qt();
QString get_os_release_qt();
bool submit_uk_pingback();
//弹出登录框
void popup_login_dialog();
void popup_register_dialog();
//退出登录
void logout_ubuntukylin_account();
//得到SessionDbus的验证值,可以通过其判断该服务是否正在运行
// QString get_session_daemon_qt();
//退出sessiondubs服务
void exit_qt();
//得到安装操作系统的语言版本
// QString get_locale_version();
// //得到当前登录用户的主目录
QString getHomePath();
//----get system message
//存放当前系统和桌面信息
QMap systemInfo;
//得到当前系统和桌面信息
QMap get_system_message_qt();
// void set_default_launcher_have_showdesktopicon_qt();
// /*-------------------desktop of beauty-------------------*/
bool set_show_desktop_icons_qt(bool flag);
bool get_show_desktop_icons_qt();
bool set_show_computer_qt(bool flag);
bool get_show_computer_qt();
bool set_show_homefolder_qt(bool flag);
bool get_show_homefolder_qt();
bool set_show_network_qt(bool flag);
bool get_show_network_qt();
bool set_show_trash_qt(bool flag);
bool get_show_trash_qt();
bool set_show_devices_qt(bool flag);
bool get_show_devices_qt();
void start_check_source_useable_qt();
// Q_INVOKABLE bool get_show_cinnamon_desktop_icons_qt();
// Q_INVOKABLE bool set_show_cinnamon_desktop_icons_qt(bool flag);
// Q_INVOKABLE bool get_show_cinnamon_computer_qt();
// Q_INVOKABLE bool set_show_cinnamon_computer_qt(bool flag);
// Q_INVOKABLE bool get_show_cinnamon_homefolder_qt();
// Q_INVOKABLE bool set_show_cinnamon_homefolder_qt(bool flag);
// Q_INVOKABLE bool get_show_cinnamon_network_qt();
// Q_INVOKABLE bool set_show_cinnamon_network_qt(bool flag);
// Q_INVOKABLE bool get_show_cinnamon_trash_qt();
// Q_INVOKABLE bool set_show_cinnamon_trash_qt(bool flag);
// Q_INVOKABLE bool get_show_cinnamon_devices_qt();
// Q_INVOKABLE bool set_show_cinnamon_devices_qt(bool flag);
/*-------------------unity of beauty-------------------*/
bool set_launcher_autohide_qt(bool flag);
bool get_launcher_autohide_qt();
bool set_launcher_icon_size_qt(int num);
int get_launcher_icon_size_qt();
bool set_launcher_have_showdesktopicon_qt(bool flag);
bool get_launcher_have_showdesktopicon_qt();
//-----------------mate of beauty--------------------*/
bool set_mate_panel_autohide_qt(QString positon, bool flag);
bool get_mate_panel_autohide_qt(QString positon);
bool set_mate_panel_icon_size_qt(QString positon, int num);
int get_mate_panel_icon_size_qt(QString positon);
//透明度
double get_launcher_transparency_qt();
bool set_launcher_transparency_qt(double opacity);
//图标背景
QStringList get_all_launcher_icon_colourings_qt();
int get_launcher_icon_colouring_qt();
bool set_launcher_icon_colouring_qt(int colouring);
//Launcher position
QString get_current_launcher_position_qt();
QStringList get_all_launcher_position_qt();
bool set_launcher_position_qt(QString position);
//Dash背景模糊类型
int get_dash_blur_experimental_qt();
bool set_dash_blur_experimental_qt(int blur);
//面板菜单透明度
double get_panel_transparency_qt();
bool set_panel_transparency_qt(double opacity);
//日期时间格式
QStringList get_all_time_format_qt();
QString get_time_format_qt();
bool set_time_format_qt(QString format);
bool get_show_seconds_qt();
bool set_show_seconds_qt(bool flag);
bool get_show_week_qt();
bool set_show_week_qt(bool flag);
bool get_show_date_qt();
bool set_show_date_qt(bool flag);
//电源
QStringList get_all_power_icon_policy_qt();
QString get_power_icon_policy_qt();
bool set_power_icon_policy_qt(QString flag);
bool get_show_power_time_qt();
bool set_show_power_time_qt(bool flag);
bool get_show_power_percentage_qt();
bool set_show_power_percentage_qt(bool flag);
bool get_show_apps_qt();
bool set_show_apps_qt(bool flag);
bool get_show_desktop_qt();
bool set_show_desktop_qt(bool flag);
bool get_show_icon_qt();
bool set_show_icon_qt(bool flag);
bool get_show_places_qt();
bool set_show_places_qt(bool flag);
/*-------------------theme of beauty-------------------*/
QStringList get_themes_qt();
QString get_theme_qt();
void set_theme_qt(QString theme);
QStringList get_icon_themes_qt();
QString get_icon_theme_qt();
void set_icon_theme_qt(QString theme);
QStringList get_cursor_themes_qt();
QString get_cursor_theme_qt();
void set_cursor_theme_qt(QString theme);
int get_cursor_size_qt();
void set_cursor_size_qt(int size);
//window theme
// QStringList get_window_themes_qt();
// QString get_current_window_theme_qt();
// void set_window_theme_qt(QString theme);
// /*-------------------fonts of beauty-------------------*/
QString get_default_font_string_qt(QString schema, QString key);
bool set_default_font_string_qt(QString schema, QString key, QString type);
QString get_font_qt();
// Q_INVOKABLE bool set_font_qt_default(QString font);
bool set_font_qt(QString font);
QString get_desktop_font_qt();
bool set_desktop_font_qt_default();//when is null ,we set a default value
bool set_desktop_font_qt(QString font);
QString get_document_font_qt();
// Q_INVOKABLE bool set_document_font_qt_default(QString font);
bool set_document_font_qt(QString font);
QString get_monospace_font_qt();
// Q_INVOKABLE bool set_monospace_font_qt_default(QString font);
bool set_monospace_font_qt(QString font);
QString get_window_title_font_qt();
// Q_INVOKABLE bool set_window_title_font_qt_default(QString font);
bool set_window_title_font_qt(QString font);
double get_font_zoom_qt();
bool set_font_zoom_qt(double zoom);
QStringList get_smooth_style_list_qt();
QString get_smooth_style_qt();
bool set_smooth_style_qt(QString style);
QStringList get_antialiasing_style_list_qt();
QString get_antialiasing_style_qt();
bool set_antialiasing_style_qt(QString style);
/*-------------------scrollbars of beauty-------------------*/
bool set_scrollbars_mode_overlay_qt();
bool set_scrollbars_mode_legacy_qt();
QString get_scrollbars_mode_qt();
/*-------------------touchpad of beauty-------------------*/
bool set_touchpad_enable_qt(bool flag);
bool get_touchpad_enable_qt();
bool set_touchscrolling_mode_disabled_qt();
bool set_touchscrolling_mode_edge_qt();
bool set_touchscrolling_mode_twofinger_qt();
QString get_touchscrolling_mode_qt();
bool set_touchscrolling_use_horizontal_qt(bool flag);
bool get_touchscrolling_use_horizontal_qt();
int get_mate_touchscrolling_mode_qt();
bool set_mate_touchscrolling_mode_qt(int value);
/*-------------------window of beauty-------------------*/
void set_window_button_align_left_qt();
void set_window_button_align_right_qt();
QString get_window_button_align_qt();
bool set_menus_have_icons_qt(bool flag);
bool get_menus_have_icons_qt();
QStringList get_titlebar_wheel_qt();
QString get_current_titlebar_wheel_qt();
void set_titlebar_wheel_qt(QString value);
QStringList get_titlebar_options_qt();
QString get_current_titlebar_double_qt();
void set_titlebar_double_qt(QString value);
// QStringList get_titlebar_middle_qt();
QString get_current_titlebar_middle_qt();
void set_titlebar_middle_qt(QString value);
// QStringList get_titlebar_right_qt();
QString get_current_titlebar_right_qt();
void set_titlebar_right_qt(QString value);
/*-------------------sound of beauty-------------------*/
void set_sound_event_enable_qt(bool flag);
bool get_sound_event_enable_qt();
void set_input_feedback_sounds_enable_qt(bool flag);
bool get_input_feedback_sounds_enable_qt();
void set_login_music_enable_qt(bool flag);
bool get_login_music_enable_qt();
QString get_sound_theme_qt();
void set_sound_theme_qt(QString theme);
/*-------------------filemanager of beauty-------------------*/
void set_location_replace_pathbar_qt(bool flag);
bool get_location_replace_pathbar_qt();
void set_auto_mount_media_qt(bool flag);
bool get_auto_mount_media_qt();
void set_auto_open_folder_qt(bool flag);
bool get_auto_open_folder_qt();
void set_prompt_autorun_programs_qt(bool flag);
bool get_prompt_autorun_programs_qt();
void set_thumbnail_icon_size_qt(int size);
int get_thumbnail_icon_size_qt();
void set_thumbnail_cache_time_qt(int value);
int get_thumbnail_cache_time_qt();
void set_thumbnail_cache_size_qt(int size);
int get_thumbnail_cache_size_qt();
QString access_current_desktop_qt();
QString access_current_machine_qt();
// Q_INVOKABLE QString judge_desktop_is_unity_qt();
// Q_INVOKABLE QString judge_desktop_is_cinnamon_qt();
//一键清理扫描
void onekey_scan_function_qt(QStringList selectedList);
//-------------------conserve energe----------------
void adjust_screen_gamma_qt(double gamma);
double get_screen_gamma_qt();
QStringList get_idle_delay_list_qt();
QString get_current_idle_delay_qt();
void set_current_idle_delay_qt(int value);
bool get_lock_enabled_qt();
void set_lock_enabled_qt(bool value);
QStringList get_lock_delay_list_qt();
QString get_current_lock_delay_qt();
void set_current_lock_delay_qt(int value);
QStringList get_sleep_timeout_list_qt();
QString get_current_critical_low_qt();
void set_current_critical_low_qt(QString value);
QString get_current_lid_battery_qt();
void set_current_lid_battery_qt(QString value);
QString get_current_lid_ac_qt();
void set_current_lid_ac_qt(QString value);
QString get_current_sleep_timeout_display_battery_qt();
void set_current_sleep_timeout_display_battery_qt(int value);
QString get_current_sleep_timeout_display_ac_qt();
void set_current_sleep_timeout_display_ac_qt(int value);
QString get_current_sleep_timeout_battery_qt();
void set_current_sleep_timeout_battery_qt(int value);
QString get_current_sleep_timeout_ac_qt();
void set_current_sleep_timeout_ac_qt(int value);
signals:
void tellAutoModel(const QStringList &data);
void showAutoModel();
void finishScanWork(QString msg);
void isScanning(QString msg);
void tellCleanerDetailData(const QStringList &data);
void tellCleanerDetailStatus(const QString &status);
void tellCleanerDetailError(const QString &status);
void tellScanResult(QString flag, QString msg);
void ssoSuccessSignal(QString displayName, QString emailAddress);
void ssoLoginLogoutSignal(bool loginFlag);
void bool_value_notify(QString key, bool value);
void int_value_notify(QString key, int value);
void double_value_notify(QString key, double value);
void string_value_notify(QString key, QString value);
void receive_source_list_signal(bool result);
public slots:
void handlerAutoManageData(QStringList data);
// void handlerAutoManageData(const QVariantMap &data);
void handlerAutoManageStatus(QString status);
void handlerAutoManageError(QString status);
void handlerScanCleanerData(QStringList data);
void handlerScanCleanerStatus(QString status);
void handlerScanCleanerError(QString status);
//扫描完成槽函数
void handler_scan_complete(QString msg);
//扫描过程的函数
void handler_scan_process(QString msg);
//扫描的总数
void handler_total_data_transmit(QString flag, QString msg);
void handlerYoukerID(QString displayName, QString emailAddress);
void handlerLogoutSuccess();
void handlerLoginFail();
// notify changes
void handler_notify_boolean(QString key, bool value);
void handler_notify_int(QString key, int value);
void handler_notify_double(QString key, double value);
void handler_notify_string(QString key, QString value);
private:
QDBusInterface *sessioniface;
/*KThread *check_thread;
KThread *scan_thread;
KThread *onekey_scan_thread;*/
};
#endif // SESSIONDISPATCHER_H
youker-assistant-3.0.2/dbusproxy/youkersessiondbus.cpp 0000664 0001750 0001750 00000127650 13600302431 022031 0 ustar feng feng /*
* Copyright (C) 2013 ~ 2015 National University of Defense Technology(NUDT) & Kylin Ltd.
*
* Authors:
* Kobe Lee xiangli@ubuntukylin.com/kobe24_lixiang@126.com
*
* 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; 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, see .
*/
#include "youkersessiondbus.h"
#include
SessionDispatcher::SessionDispatcher(QObject *parent)
: QObject(parent)
{
sessioniface = new QDBusInterface("com.kylin.assistant.sessiondaemon",
"/com/kylin/assistant/sessiondaemon",
"com.kylin.assistant.sessiondaemon",
QDBusConnection::sessionBus());
qDebug() << "Starting SessionDispatcher";
// QObject::connect(sessioniface, SIGNAL(autostartmanage_data_signal(QVariantMap)), this, SLOT(handlerAutoManageData(QVariantMap)));
QObject::connect(sessioniface, SIGNAL(autostartmanage_data_signal(QStringList)), this, SLOT(handlerAutoManageData(QStringList)));
QObject::connect(sessioniface, SIGNAL(autostartmanage_status_signal(QString)), this, SLOT(handlerAutoManageStatus(QString)));
QObject::connect(sessioniface, SIGNAL(autostartmanage_error_signal(QString)), this, SLOT(handlerAutoManageError(QString)));
QObject::connect(sessioniface, SIGNAL(subpage_data_signal(QStringList)), this, SLOT(handlerScanCleanerData(QStringList)));
QObject::connect(sessioniface, SIGNAL(subpage_status_signal(QString)), this, SLOT(handlerScanCleanerStatus(QString)));
QObject::connect(sessioniface, SIGNAL(subpage_error_signal(QString)), this, SLOT(handlerScanCleanerError(QString)));
// thread = new KThread(this);
/*
//kobe
check_thread = new KThread(this);
scan_thread = new KThread(this);
onekey_scan_thread = new KThread(this);
*/
QObject::connect(sessioniface, SIGNAL(display_scan_process(QString)), this, SLOT(handler_scan_process(QString)));
QObject::connect(sessioniface, SIGNAL(scan_complete(QString)), this, SLOT(handler_scan_complete(QString)));
QObject::connect(sessioniface, SIGNAL(total_data_transmit(QString, QString)), this, SLOT(handler_total_data_transmit(QString,QString)));
QObject::connect(sessioniface, SIGNAL(youkerid_whoami_signal(QString, QString)), this, SLOT(handlerYoukerID(QString, QString)));
QObject::connect(sessioniface, SIGNAL(youkerid_logout_signal()), this, SLOT(handlerLogoutSuccess()));
QObject::connect(sessioniface, SIGNAL(youkerid_login_fail_signal()), this, SLOT(handlerLoginFail()));
QObject::connect(sessioniface, SIGNAL(notify_boolean(QString, bool)), this, SLOT(handler_notify_boolean(QString, bool)));
QObject::connect(sessioniface, SIGNAL(notify_int(QString, int)), this, SLOT(handler_notify_int(QString, int)));
QObject::connect(sessioniface, SIGNAL(notify_double(QString, double)), this, SLOT(handler_notify_double(QString, double)));
QObject::connect(sessioniface, SIGNAL(notify_string(QString, QString)), this, SLOT(handler_notify_string(QString, QString)));
QObject::connect(sessioniface, SIGNAL(check_source_list_signal(bool)), this, SIGNAL(receive_source_list_signal(bool)));
//pingback
this->submit_uk_pingback();
}
SessionDispatcher::~SessionDispatcher() {
/*check_thread->terminate();
check_thread->wait();
if(check_thread != NULL) {
delete check_thread;
check_thread = NULL;
}
scan_thread->terminate();
scan_thread->wait();
if(scan_thread != NULL) {
delete scan_thread;
scan_thread = NULL;
}
onekey_scan_thread->terminate();
onekey_scan_thread->wait();
if(onekey_scan_thread != NULL) {
delete onekey_scan_thread;
onekey_scan_thread = NULL;
}*/
// thread->terminate();
// thread->wait();
// if(thread != NULL) {
// delete thread;
// thread = NULL;
// }
this->exit_qt();
if (sessioniface != NULL) {
delete sessioniface;
sessioniface = NULL;
}
}
//dbus服务退出
void SessionDispatcher::exit_qt()
{
sessioniface->call("exit");
}
QString SessionDispatcher::get_os_release_qt()
{
QDBusReply reply = sessioniface->call("get_os_release");
return reply.value();
}
bool SessionDispatcher::submit_uk_pingback()
{
QDBusReply reply = sessioniface->call("submit_uk_pingback", qApp->applicationVersion());
return reply.value();
}
QStringList SessionDispatcher::checkNewVersion()
{
QDBusReply reply = sessioniface->call("currently_installed_version");
return reply.value();
}
void SessionDispatcher::start_check_source_useable_qt()
{
sessioniface->call("start_check_source_useable");
/*if (check_thread->isRunning()) {
qDebug() << "check_thread is running......";
}
else {
QMap data;
QStringList tmplist;
check_thread->initValues(data, tmplist, sessioniface, "start_check_source_useable");
check_thread->start();
// qDebug() << "check_thread is ready to run......";
}
return true;*/
}
void SessionDispatcher::runApp(QString pkgname)
{
sessioniface->call("run_selected_app", pkgname);
}
void SessionDispatcher::handlerAutoManageData(QStringList data)
//void SessionDispatcher::handlerAutoManageData(const QVariantMap &data)
{
emit this->tellAutoModel(data);
}
void SessionDispatcher::handlerAutoManageStatus(QString status)
{
emit this->showAutoModel();
}
void SessionDispatcher::handlerAutoManageError(QString status)
{
}
void SessionDispatcher::getAutoStartAppStatus()
{
sessioniface->call("get_current_autostart_status");
}
bool SessionDispatcher::getSingleAutoStartStatus(QString abs_path)
{
QDBusReply reply = sessioniface->call("get_current_single_autostart_status", abs_path);
return reply.value();
}
void SessionDispatcher::changeAutoStartAppStatus(QString appName)
{
sessioniface->call("change_autostart_status", appName);
}
void SessionDispatcher::handlerScanCleanerData(QStringList data)
{
emit this->tellCleanerDetailData(data);
}
void SessionDispatcher::handlerScanCleanerStatus(QString status)
{
emit this->tellCleanerDetailStatus(status);
}
void SessionDispatcher::handlerScanCleanerError(QString status)
{
emit this->tellCleanerDetailError(status);
}
//bool SessionDispatcher::judge_camera_qt() {
// QDBusReply reply = sessioniface->call("judge_camera");
// return reply.value();
//}
//void SessionDispatcher::call_camera_qt() {
// sessioniface->call("call_camera");
//// if (thread->isRunning()) {
//// qDebug() << "camera_thread is running......";
//// }
//// else {
//// qDebug() << "camera_thread is ready to run......";
//// QStringList tmp;
//// QMap data;
//// thread->initValues(data, tmp, sessioniface, "call_camera");
//// thread->start();
//// }
//}
bool SessionDispatcher::judge_power_is_exists_qt()
{
QDBusReply reply = sessioniface->call("judge_power_is_exists");
return reply.value();
}
QMap SessionDispatcher::read_battery_info_qt()
{
QMap value;
QDBusReply > reply = sessioniface->call("read_battery_info");
if (reply.isValid()) {
value = reply.value();
if (value.contains("POWER_SUPPLY_VOLTAGE_NOW")) {
value["POWER_SUPPLY_VOLTAGE_NOW"] = QString::number(value["POWER_SUPPLY_VOLTAGE_NOW"].toDouble()/1000000, 'f', 1) + "V";
}
if (value.contains("POWER_SUPPLY_ENERGY_FULL_DESIGN")) {
value["POWER_SUPPLY_ENERGY_FULL_DESIGN"] = QString::number(value["POWER_SUPPLY_ENERGY_FULL_DESIGN"].toDouble()/1000000, 'f', 1) + "Wh";
}
if (value.contains("POWER_SUPPLY_ENERGY_FULL")) {
value["POWER_SUPPLY_ENERGY_FULL"] = QString::number(value["POWER_SUPPLY_ENERGY_FULL"].toDouble()/1000000, 'f', 1) + "Wh";
}
if (value.contains("POWER_SUPPLY_ENERGY_NOW")) {
value["POWER_SUPPLY_ENERGY_NOW"] = QString::number(value["POWER_SUPPLY_ENERGY_NOW"].toDouble()/1000000, 'f', 1) + "Wh";
}
return value;
}
else {
qDebug() << "get battery_message failed!";
// QMap value;
// value.insert("kylinkobe", "kylinkobe");
return value;
}
}
void SessionDispatcher::open_folder_qt(QString path)
{
sessioniface->call("open_folder", path);
}
void SessionDispatcher::check_user_qt()
{
// sessioniface->call("check_user");
}
//弹出登录框
void SessionDispatcher::popup_login_dialog()
{
//add ubuntukylin sso
// sessioniface->call("slot_do_login_account");
}
void SessionDispatcher::popup_register_dialog()
{
//add ubuntukylin sso
// sessioniface->call("slot_do_register");
}
//退出登录
void SessionDispatcher::logout_ubuntukylin_account()
{
//add ubuntukylin sso
// sessioniface->call("slot_do_logout");
}
void SessionDispatcher::handlerYoukerID(QString displayName, QString emailAddress)
{
emit this->ssoSuccessSignal(displayName, emailAddress);
}
void SessionDispatcher::handlerLogoutSuccess()
{
emit this->ssoLoginLogoutSignal(true);
}
void SessionDispatcher::handlerLoginFail()
{
emit this->ssoLoginLogoutSignal(false);
}
void SessionDispatcher::handler_scan_complete(QString msg)
{
emit finishScanWork(msg);
}
void SessionDispatcher::handler_scan_process(QString msg)
{
emit isScanning(msg);
}
void SessionDispatcher::handler_total_data_transmit(QString flag, QString msg)
{
emit tellScanResult(flag, msg);
}
//QString SessionDispatcher::get_locale_version() {
// QString locale = QLocale::system().name();
// return locale;
//}
//一键扫描
void SessionDispatcher::onekey_scan_function_qt(QStringList selectedList)
{
// QMap data;
// thread->initValues(data, selectedList, sessioniface, "onekey_scan_function");
// thread->start();
sessioniface->call("onekey_scan_function", selectedList);
/*if (scan_thread->isRunning()) {
qDebug() << "onekey_scan_thread is running......";
}
else {
// qDebug() << "onekey_scan_thread is ready to run......";
QMap data;
onekey_scan_thread->initValues(data, selectedList, sessioniface, "onekey_scan_function");
onekey_scan_thread->start();
}*/
}
//系统扫描
void SessionDispatcher::scanSystemCleanerItems(QMap data)
{
sessioniface->call("get_scan_result", data);
/*if (scan_thread->isRunning()) {
qDebug() << "scan_thread is running......";
}
else {
// if (scan_thread == NULL)
// qDebug() << "scan_thread is null, ready to run......";
// else
// qDebug() << "scan_thread is not null, ready to run......";
QStringList tmp;
scan_thread->initValues(data, tmp, sessioniface, "get_scan_result");
scan_thread->start();
// QElapsedTimer et;
// et.start();
// while(et.elapsed()<300)
// QCoreApplication::processEvents();
}*/
}
QString SessionDispatcher::getHomePath()
{
QString homepath = QDir::homePath();
return homepath;
}
//QString SessionDispatcher::get_session_daemon_qt() {
// QDBusReply reply = sessioniface->call("get_session_daemon");
// return reply.value();
//}
QMap SessionDispatcher::get_system_message_qt()
{
QMap value;
QDBusReply > reply = sessioniface->call("get_system_message");
if (reply.isValid()) {
value = reply.value();
return value;
// systemInfo.clear();
// systemInfo = value;
//把当前登录的用户名存放到QSetting配置文件中,方便任务管理器使用
// mSettings->beginGroup("user");
// mSettings->setValue("currentName", systemInfo["currrent_user"].toString());
// mSettings->endGroup();
// mSettings->sync();
}
else {
qDebug() << "get pc_message failed!";
// QMap value;
// value.insert("kylinkobe", "kylinkobe");
return value;
}
}
/*-----------------------------desktop of beauty-----------------------------*/
bool SessionDispatcher::set_show_desktop_icons_qt(bool flag)
{
QDBusReply reply = sessioniface->call("set_show_desktop_icons", flag);
return reply.value();
}
bool SessionDispatcher::get_show_desktop_icons_qt()
{
QDBusReply reply = sessioniface->call("get_show_desktop_icons");
return reply.value();
}
bool SessionDispatcher::set_show_computer_qt(bool flag)
{
QDBusReply reply = sessioniface->call("set_show_computer", flag);
return reply.value();
}
bool SessionDispatcher::get_show_computer_qt()
{
QDBusReply reply = sessioniface->call("get_show_computer");
return reply.value();
}
bool SessionDispatcher::set_show_homefolder_qt(bool flag)
{
QDBusReply reply = sessioniface->call("set_show_homefolder", flag);
return reply.value();
}
bool SessionDispatcher::get_show_homefolder_qt()
{
QDBusReply reply = sessioniface->call("get_show_homefolder");
return reply.value();
}
bool SessionDispatcher::set_show_network_qt(bool flag)
{
QDBusReply reply = sessioniface->call("set_show_network", flag);
return reply.value();
}
bool SessionDispatcher::get_show_network_qt()
{
QDBusReply reply = sessioniface->call("get_show_network");
return reply.value();
}
bool SessionDispatcher::set_show_trash_qt(bool flag)
{
QDBusReply reply = sessioniface->call("set_show_trash", flag);
return reply.value();
}
bool SessionDispatcher::get_show_trash_qt()
{
QDBusReply reply = sessioniface->call("get_show_trash");
return reply.value();
}
bool SessionDispatcher::set_show_devices_qt(bool flag)
{
QDBusReply reply = sessioniface->call("set_show_devices", flag);
return reply.value();
}
bool SessionDispatcher::get_show_devices_qt()
{
QDBusReply reply = sessioniface->call("get_show_devices");
return reply.value();
}
//bool SessionDispatcher::get_show_cinnamon_desktop_icons_qt() {
// QDBusReply reply = sessioniface->call("get_show_cinnamon_desktop_icons");
// return reply.value();
//}
//bool SessionDispatcher::set_show_cinnamon_desktop_icons_qt(bool flag) {
// QDBusReply reply = sessioniface->call("set_show_cinnamon_desktop_icons", flag);
// return reply.value();
//}
//bool SessionDispatcher::get_show_cinnamon_computer_qt() {
// QDBusReply reply = sessioniface->call("get_show_cinnamon_computer");
// return reply.value();
//}
//bool SessionDispatcher::set_show_cinnamon_computer_qt(bool flag) {
// QDBusReply reply = sessioniface->call("set_show_cinnamon_computer", flag);
// return reply.value();
//}
//bool SessionDispatcher::get_show_cinnamon_homefolder_qt() {
// QDBusReply reply = sessioniface->call("get_show_cinnamon_homefolder");
// return reply.value();
//}
//bool SessionDispatcher::set_show_cinnamon_homefolder_qt(bool flag) {
// QDBusReply reply = sessioniface->call("set_show_cinnamon_homefolder", flag);
// return reply.value();
//}
//bool SessionDispatcher::get_show_cinnamon_network_qt() {
// QDBusReply reply = sessioniface->call("get_show_cinnamon_network");
// return reply.value();
//}
//bool SessionDispatcher::set_show_cinnamon_network_qt(bool flag) {
// QDBusReply reply = sessioniface->call("set_show_cinnamon_network", flag);
// return reply.value();
//}
//bool SessionDispatcher::get_show_cinnamon_trash_qt() {
// QDBusReply reply = sessioniface->call("get_show_cinnamon_trash");
// return reply.value();
//}
//bool SessionDispatcher::set_show_cinnamon_trash_qt(bool flag) {
// QDBusReply reply = sessioniface->call("set_show_cinnamon_trash", flag);
// return reply.value();
//}
//bool SessionDispatcher::get_show_cinnamon_devices_qt() {
// QDBusReply reply = sessioniface->call("get_show_cinnamon_devices");
// return reply.value();
//}
//bool SessionDispatcher::set_show_cinnamon_devices_qt(bool flag) {
// QDBusReply reply = sessioniface->call("set_show_cinnamon_devices", flag);
// return reply.value();
//}
/*-----------------------------unity of beauty-----------------------------*/
//void SessionDispatcher::set_default_launcher_have_showdesktopicon_qt() {
// sessioniface->call("set_default_launcher_have_showdesktopicon");
//}
bool SessionDispatcher::set_launcher_autohide_qt(bool flag)
{
QDBusReply reply = sessioniface->call("set_launcher_autohide", flag);
return reply.value();
// return true;
}
bool SessionDispatcher::get_launcher_autohide_qt()
{
QDBusReply reply = sessioniface->call("get_launcher_autohide");
return reply.value();
// return true;
}
bool SessionDispatcher::set_launcher_icon_size_qt(int num)
{
QDBusReply reply = sessioniface->call("set_launcher_icon_size", num);
return reply.value();
}
int SessionDispatcher::get_launcher_icon_size_qt()
{
QDBusReply reply = sessioniface->call("get_launcher_icon_size");
return reply.value();
// return 32;
}
bool SessionDispatcher::set_launcher_have_showdesktopicon_qt(bool flag)
{
QDBusReply reply = sessioniface->call("set_launcher_have_showdesktopicon", flag);
return reply.value();
// return true;
}
bool SessionDispatcher::get_launcher_have_showdesktopicon_qt()
{
QDBusReply reply = sessioniface->call("get_launcher_have_showdesktopicon");
return reply.value();
// return true;
}
//-----------------------------------------------mate----------------------------------------------
bool SessionDispatcher::set_mate_panel_autohide_qt(QString positon, bool flag)
{
QDBusReply reply = sessioniface->call("set_mate_panel_autohide", positon, flag);
return reply.value();
}
bool SessionDispatcher::get_mate_panel_autohide_qt(QString positon)
{
QDBusReply reply = sessioniface->call("get_mate_panel_autohide", positon);
return reply.value();
}
bool SessionDispatcher::set_mate_panel_icon_size_qt(QString positon, int num)
{
QDBusReply reply = sessioniface->call("set_mate_panel_icon_size", positon, num);
return reply.value();
}
int SessionDispatcher::get_mate_panel_icon_size_qt(QString positon)
{
QDBusReply reply = sessioniface->call("get_mate_panel_icon_size", positon);
return reply.value();
}
//透明度
double SessionDispatcher::get_launcher_transparency_qt() {
QDBusReply reply = sessioniface->call("get_launcher_transparency");
return reply.value();
// return 0.0;
}
bool SessionDispatcher::set_launcher_transparency_qt(double opacity) {
QDBusReply reply = sessioniface->call("set_launcher_transparency", opacity);
return reply.value();
}
//图标背景
QStringList SessionDispatcher::get_all_launcher_icon_colourings_qt() {
QDBusReply reply = sessioniface->call("get_all_launcher_icon_colourings");
return reply.value();
// return QStringList();
}
int SessionDispatcher::get_launcher_icon_colouring_qt() {
QDBusReply reply = sessioniface->call("get_launcher_icon_colouring");
return reply.value();
// return 0;
}
bool SessionDispatcher::set_launcher_icon_colouring_qt(int colouring)
{
QDBusReply reply = sessioniface->call("set_launcher_icon_colouring", colouring);
return reply.value();
}
//Dash背景模糊类型
int SessionDispatcher::get_dash_blur_experimental_qt() {
QDBusReply reply = sessioniface->call("get_dash_blur_experimental");
return reply.value();
}
bool SessionDispatcher::set_dash_blur_experimental_qt(int blur) {
QDBusReply reply = sessioniface->call("set_dash_blur_experimental", blur);
return reply.value();
}
//面板菜单透明度
double SessionDispatcher::get_panel_transparency_qt() {
QDBusReply reply = sessioniface->call("get_panel_transparency");
return reply.value();
}
bool SessionDispatcher::set_panel_transparency_qt(double opacity) {
QDBusReply reply = sessioniface->call("set_panel_transparency", opacity);
return reply.value();
}
//日期时间格式
QStringList SessionDispatcher::get_all_time_format_qt() {
QDBusReply reply = sessioniface->call("get_all_time_format");
return reply.value();
}
QString SessionDispatcher::get_time_format_qt() {
QDBusReply reply = sessioniface->call("get_time_format");
return reply.value();
}
bool SessionDispatcher::set_time_format_qt(QString format) {
QDBusReply reply = sessioniface->call("set_time_format", format);
return reply.value();
}
bool SessionDispatcher::get_show_seconds_qt() {
QDBusReply reply = sessioniface->call("get_show_seconds");
return reply.value();
}
bool SessionDispatcher::set_show_seconds_qt(bool flag) {
QDBusReply reply = sessioniface->call("set_show_seconds", flag);
return reply.value();
}
bool SessionDispatcher::get_show_week_qt() {
QDBusReply reply = sessioniface->call("get_show_week");
return reply.value();
}
bool SessionDispatcher::set_show_week_qt(bool flag) {
QDBusReply reply = sessioniface->call("set_show_week", flag);
return reply.value();
}
bool SessionDispatcher::get_show_date_qt() {
QDBusReply reply = sessioniface->call("get_show_date");
return reply.value();
}
bool SessionDispatcher::set_show_date_qt(bool flag) {
QDBusReply reply = sessioniface->call("set_show_date", flag);
return reply.value();
}
//电源
QStringList SessionDispatcher::get_all_power_icon_policy_qt() {
QDBusReply reply = sessioniface->call("get_all_power_icon_policy");
return reply.value();
}
QString SessionDispatcher::get_power_icon_policy_qt() {
QDBusReply reply = sessioniface->call("get_power_icon_policy");
return reply.value();
}
bool SessionDispatcher::set_power_icon_policy_qt(QString format) {
QDBusReply reply = sessioniface->call("set_power_icon_policy", format);
return reply.value();
}
bool SessionDispatcher::get_show_power_time_qt() {
QDBusReply reply = sessioniface->call("get_show_power_time");
return reply.value();
}
bool SessionDispatcher::set_show_power_time_qt(bool flag) {
QDBusReply reply = sessioniface->call("set_show_power_time", flag);
return reply.value();
}
bool SessionDispatcher::get_show_power_percentage_qt() {
QDBusReply reply = sessioniface->call("get_show_power_percentage");
return reply.value();
}
bool SessionDispatcher::set_show_power_percentage_qt(bool flag) {
QDBusReply reply = sessioniface->call("set_show_power_percentage", flag);
return reply.value();
}
//--------------------------mate--------------------
bool SessionDispatcher::get_show_apps_qt() {
QDBusReply reply = sessioniface->call("get_show_apps");
return reply.value();
}
bool SessionDispatcher::set_show_apps_qt(bool flag) {
QDBusReply reply = sessioniface->call("set_show_apps", flag);
return reply.value();
}
bool SessionDispatcher::get_show_desktop_qt() {
QDBusReply reply = sessioniface->call("get_show_desktop");
return reply.value();
}
bool SessionDispatcher::set_show_desktop_qt(bool flag) {
QDBusReply reply = sessioniface->call("set_show_desktop", flag);
return reply.value();
}
bool SessionDispatcher::get_show_icon_qt() {
QDBusReply reply = sessioniface->call("get_show_icon");
return reply.value();
}
bool SessionDispatcher::set_show_icon_qt(bool flag) {
QDBusReply reply = sessioniface->call("set_show_icon", flag);
return reply.value();
}
bool SessionDispatcher::get_show_places_qt() {
QDBusReply reply = sessioniface->call("get_show_places");
return reply.value();
}
bool SessionDispatcher::set_show_places_qt(bool flag) {
QDBusReply reply = sessioniface->call("set_show_places", flag);
return reply.value();
}
/*-----------------------------theme of beauty-----------------------------*/
QStringList SessionDispatcher::get_themes_qt() {
QDBusReply reply = sessioniface->call("get_themes");
return reply.value();
}
QString SessionDispatcher::get_theme_qt() {
QDBusReply reply = sessioniface->call("get_theme");
return reply.value();
}
void SessionDispatcher::set_theme_qt(QString theme) {
sessioniface->call("set_theme", theme);
}
QStringList SessionDispatcher::get_icon_themes_qt() {
QDBusReply reply = sessioniface->call("get_icon_themes");
return reply.value();
}
QString SessionDispatcher::get_icon_theme_qt() {
QDBusReply reply = sessioniface->call("get_icon_theme");
return reply.value();
}
void SessionDispatcher::set_icon_theme_qt(QString theme) {
sessioniface->call("set_icon_theme", theme);
}
QStringList SessionDispatcher::get_cursor_themes_qt() {
QDBusReply reply = sessioniface->call("get_cursor_themes");
return reply.value();
}
QString SessionDispatcher::get_cursor_theme_qt() {
QDBusReply reply = sessioniface->call("get_cursor_theme");
return reply.value();
}
void SessionDispatcher::set_cursor_theme_qt(QString theme) {
sessioniface->call("set_cursor_theme", theme);
}
int SessionDispatcher::get_cursor_size_qt() {
QDBusReply reply = sessioniface->call("get_cursor_size");
return reply.value();
}
void SessionDispatcher::set_cursor_size_qt(int size) {
sessioniface->call("set_cursor_size", size);
}
//window theme
//QStringList SessionDispatcher::get_window_themes_qt() {
// QDBusReply reply = sessioniface->call("get_window_themes");
// return reply.value();
//}
//QString SessionDispatcher::get_current_window_theme_qt() {
// QDBusReply reply = sessioniface->call("get_current_window_theme");
// return reply.value();
//}
//void SessionDispatcher::set_window_theme_qt(QString theme) {
// sessioniface->call("set_window_theme", theme);
//}
QString SessionDispatcher::get_default_font_string_qt(QString schema, QString key)
{
QDBusReply reply = sessioniface->call("get_default_font_string", schema, key);
return reply.value();
}
bool SessionDispatcher::set_default_font_string_qt(QString schema, QString key, QString type)
{
QDBusReply reply = sessioniface->call("set_default_font", schema, key, type);
return reply.value();
}
QString SessionDispatcher::get_font_qt() {
QDBusReply reply = sessioniface->call("get_font");
return reply.value();
}
//bool SessionDispatcher::set_font_qt_default(QString font) {
// QDBusReply reply = sessioniface->call("set_font", font);
// return reply.value();
//}
bool SessionDispatcher::set_font_qt(QString font) {
QDBusReply reply = sessioniface->call("set_font", font);
return reply.value();
}
QString SessionDispatcher::get_desktop_font_qt() {
QDBusReply reply = sessioniface->call("get_desktop_font");
return reply.value();
}
bool SessionDispatcher::set_desktop_font_qt(QString font) {
QDBusReply reply = sessioniface->call("set_desktop_font", font);
return reply.value();
}
bool SessionDispatcher::set_desktop_font_qt_default() {
QDBusReply reply = sessioniface->call("set_desktop_font", "Ubuntu 11");
return reply.value();
}
QString SessionDispatcher::get_document_font_qt() {
QDBusReply reply = sessioniface->call("get_document_font");
return reply.value();
}
//bool SessionDispatcher::set_document_font_qt_default(QString font) {
// QDBusReply reply = sessioniface->call("set_document_font", font);
// return reply.value();
//}
bool SessionDispatcher::set_document_font_qt(QString font) {
QDBusReply reply = sessioniface->call("set_document_font", font);
return reply.value();
}
QString SessionDispatcher::get_monospace_font_qt() {
QDBusReply reply = sessioniface->call("get_monospace_font");
return reply.value();
}
//bool SessionDispatcher::set_monospace_font_qt_default(QString font) {
// QDBusReply reply = sessioniface->call("set_monospace_font", font);
// return reply.value();
//}
bool SessionDispatcher::set_monospace_font_qt(QString font) {
QDBusReply reply = sessioniface->call("set_monospace_font", font);
return reply.value();
}
QString SessionDispatcher::get_window_title_font_qt() {
QDBusReply reply = sessioniface->call("get_window_title_font");
return reply.value();
}
//bool SessionDispatcher::set_window_title_font_qt_default(QString font) {
// QDBusReply reply = sessioniface->call("set_window_title_font", font);
// return reply.value();
//}
bool SessionDispatcher::set_window_title_font_qt(QString font) {
QDBusReply reply = sessioniface->call("set_window_title_font", font);
return reply.value();
}
double SessionDispatcher::get_font_zoom_qt() {
QDBusReply reply = sessioniface->call("get_font_zoom");
return reply.value();
}
bool SessionDispatcher::set_font_zoom_qt(double zoom) {
QDBusReply reply = sessioniface->call("set_font_zoom", zoom);
return reply.value();
}
QStringList SessionDispatcher::get_smooth_style_list_qt() {
QDBusReply reply = sessioniface->call("get_smooth_style_list");
return reply.value();
}
QString SessionDispatcher::get_smooth_style_qt() {
QDBusReply reply = sessioniface->call("get_smooth_style");
return reply.value();
}
bool SessionDispatcher::set_smooth_style_qt(QString style) {
QDBusReply reply = sessioniface->call("set_smooth_style", style);
return reply.value();
}
QStringList SessionDispatcher::get_antialiasing_style_list_qt() {
QDBusReply reply = sessioniface->call("get_antialiasing_style_list");
return reply.value();
}
QString SessionDispatcher::get_antialiasing_style_qt() {
QDBusReply reply = sessioniface->call("get_antialiasing_style");
return reply.value();
}
bool SessionDispatcher::set_antialiasing_style_qt(QString style) {
QDBusReply reply = sessioniface->call("set_antialiasing_style", style);
return reply.value();
}
/*-----------------------------scrollbars of beauty-----------------------------*/
bool SessionDispatcher::set_scrollbars_mode_overlay_qt() {
QDBusReply reply = sessioniface->call("set_scrollbars_mode_overlay");
return reply.value();
}
bool SessionDispatcher::set_scrollbars_mode_legacy_qt() {
QDBusReply reply = sessioniface->call("set_scrollbars_mode_legacy");
return reply.value();
}
QString SessionDispatcher::get_scrollbars_mode_qt() {
QDBusReply reply = sessioniface->call("get_scrollbars_mode");
return reply.value();
}
/*-----------------------------touchpad of beauty-----------------------------*/
bool SessionDispatcher::set_touchpad_enable_qt(bool flag) {
QDBusReply reply = sessioniface->call("set_touchpad_enable", flag);
return reply.value();
}
bool SessionDispatcher::get_touchpad_enable_qt() {
QDBusReply reply = sessioniface->call("get_touchpad_enable");
return reply.value();
}
bool SessionDispatcher::set_touchscrolling_mode_disabled_qt() {
QDBusReply reply = sessioniface->call("set_touchscrolling_mode_disabled");
return reply.value();
}
bool SessionDispatcher::set_touchscrolling_mode_edge_qt() {
QDBusReply reply = sessioniface->call("set_touchscrolling_mode_edge");
return reply.value();
}
bool SessionDispatcher::set_touchscrolling_mode_twofinger_qt() {
QDBusReply reply = sessioniface->call("set_touchscrolling_mode_twofinger");
return reply.value();
}
QString SessionDispatcher::get_touchscrolling_mode_qt() {
QDBusReply reply = sessioniface->call("get_touchscrolling_mode");
return reply.value();
}
bool SessionDispatcher::set_touchscrolling_use_horizontal_qt(bool flag) {
QDBusReply reply = sessioniface->call("set_touchscrolling_use_horizontal", flag);
return reply.value();
}
bool SessionDispatcher::get_touchscrolling_use_horizontal_qt() {
QDBusReply reply = sessioniface->call("get_touchscrolling_use_horizontal");
return reply.value();
}
int SessionDispatcher::get_mate_touchscrolling_mode_qt()
{
QDBusReply reply = sessioniface->call("get_mate_touchscrolling_mode");
return reply.value();
}
bool SessionDispatcher::set_mate_touchscrolling_mode_qt(int value)
{
QDBusReply reply = sessioniface->call("set_mate_touchscrolling_mode", value);
return reply.value();
}
/*-----------------------------window of beauty-----------------------------*/
void SessionDispatcher::set_window_button_align_left_qt() {
sessioniface->call("set_window_button_align_left");
}
void SessionDispatcher::set_window_button_align_right_qt() {
sessioniface->call("set_window_button_align_right");
}
QString SessionDispatcher::get_window_button_align_qt() {
QDBusReply reply = sessioniface->call("get_window_button_align");
return reply.value();
}
bool SessionDispatcher::set_menus_have_icons_qt(bool flag) {
QDBusReply reply = sessioniface->call("set_menus_have_icons", flag);
return reply.value();
}
bool SessionDispatcher::get_menus_have_icons_qt() {
QDBusReply reply = sessioniface->call("get_menus_have_icons");
return reply.value();
}
QStringList SessionDispatcher::get_titlebar_wheel_qt() {
QDBusReply reply = sessioniface->call("get_titlebar_wheel");
return reply.value();
}
QString SessionDispatcher::get_current_titlebar_wheel_qt() {
QDBusReply reply = sessioniface->call("get_current_titlebar_wheel");
return reply.value();
}
void SessionDispatcher::set_titlebar_wheel_qt(QString value) {
sessioniface->call("set_titlebar_wheel", value);
}
QStringList SessionDispatcher::get_titlebar_options_qt() {
QDBusReply reply = sessioniface->call("get_titlebar_options");
return reply.value();
}
QString SessionDispatcher::get_current_titlebar_double_qt() {
QDBusReply reply = sessioniface->call("get_current_titlebar_double");
return reply.value();
}
void SessionDispatcher::set_titlebar_double_qt(QString value) {
sessioniface->call("set_titlebar_double", value);
}
//QStringList SessionDispatcher::get_titlebar_middle_qt() {
// QDBusReply reply = sessioniface->call("get_titlebar_middle");
// return reply.value();
//}
QString SessionDispatcher::get_current_titlebar_middle_qt() {
QDBusReply reply = sessioniface->call("get_current_titlebar_middle");
return reply.value();
}
void SessionDispatcher::set_titlebar_middle_qt(QString value) {
sessioniface->call("set_titlebar_middle", value);
}
//QStringList SessionDispatcher::get_titlebar_right_qt() {
// QDBusReply reply = sessioniface->call("get_titlebar_right");
// return reply.value();
//}
QString SessionDispatcher::get_current_titlebar_right_qt() {
QDBusReply reply = sessioniface->call("get_current_titlebar_right");
return reply.value();
}
void SessionDispatcher::set_titlebar_right_qt(QString value) {
sessioniface->call("set_titlebar_right", value);
}
/*-----------------------------sound of beauty-----------------------------*/
bool SessionDispatcher::get_sound_event_enable_qt() {
QDBusReply reply = sessioniface->call("get_sound_event_enable");
return reply.value();
}
void SessionDispatcher::set_sound_event_enable_qt(bool flag) {
sessioniface->call("set_sound_event_enable", flag);
}
bool SessionDispatcher::get_input_feedback_sounds_enable_qt() {
QDBusReply reply = sessioniface->call("get_input_feedback_sounds_enable");
return reply.value();
}
void SessionDispatcher::set_input_feedback_sounds_enable_qt(bool flag) {
sessioniface->call("set_input_feedback_sounds_enable", flag);
}
void SessionDispatcher::set_login_music_enable_qt(bool flag) {
sessioniface->call("set_login_music_enable", flag);
}
bool SessionDispatcher::get_login_music_enable_qt() {
QDBusReply reply = sessioniface->call("get_login_music_enable");
return reply.value();
}
QString SessionDispatcher::get_sound_theme_qt() {
QDBusReply reply = sessioniface->call("get_sound_theme");
return reply.value();
}
void SessionDispatcher::set_sound_theme_qt(QString theme) {
sessioniface->call("set_sound_theme", theme);
}
void SessionDispatcher::set_location_replace_pathbar_qt(bool flag) {
sessioniface->call("set_location_replace_pathbar", flag);
}
bool SessionDispatcher::get_location_replace_pathbar_qt() {
QDBusReply reply = sessioniface->call("get_location_replace_pathbar");
return reply.value();
}
void SessionDispatcher::set_auto_mount_media_qt(bool flag) {
sessioniface->call("set_auto_mount_media", flag);
}
bool SessionDispatcher::get_auto_mount_media_qt() {
QDBusReply reply = sessioniface->call("get_auto_mount_media");
return reply.value();
}
void SessionDispatcher::set_auto_open_folder_qt(bool flag) {
sessioniface->call("set_auto_open_folder", flag);
}
bool SessionDispatcher::get_auto_open_folder_qt() {
QDBusReply reply = sessioniface->call("get_auto_open_folder");
return reply.value();
}
void SessionDispatcher::set_prompt_autorun_programs_qt(bool flag) {
sessioniface->call("set_prompt_autorun_programs", flag);
}
bool SessionDispatcher::get_prompt_autorun_programs_qt() {
QDBusReply reply = sessioniface->call("get_prompt_autorun_programs");
return reply.value();
}
void SessionDispatcher::set_thumbnail_icon_size_qt(int size) {
sessioniface->call("set_thumbnail_icon_size", size);
}
int SessionDispatcher::get_thumbnail_icon_size_qt() {
QDBusReply reply = sessioniface->call("get_thumbnail_icon_size");
return reply.value();
}
void SessionDispatcher::set_thumbnail_cache_time_qt(int value) {
sessioniface->call("set_thumbnail_cache_time", value);
}
int SessionDispatcher::get_thumbnail_cache_time_qt() {
QDBusReply reply = sessioniface->call("get_thumbnail_cache_time");
return reply.value();
}
void SessionDispatcher::set_thumbnail_cache_size_qt(int size) {
sessioniface->call("set_thumbnail_cache_size", size);
}
int SessionDispatcher::get_thumbnail_cache_size_qt() {
QDBusReply reply = sessioniface->call("get_thumbnail_cache_size");
return reply.value();
}
QString SessionDispatcher::access_current_desktop_qt() {
QDBusReply reply = sessioniface->call("access_current_desktop");
return reply.value();
}
QString SessionDispatcher::access_current_machine_qt() {
QDBusReply reply = sessioniface->call("access_current_machine");
return reply.value();
}
//QString SessionDispatcher::judge_desktop_is_unity_qt() {
// QDBusReply reply = sessioniface->call("judge_desktop_is_unity");
// return reply.value();
//}
//QString SessionDispatcher::judge_desktop_is_cinnamon_qt() {
// QDBusReply reply = sessioniface->call("judge_desktop_is_cinnamon");
// return reply.value();
//}
void SessionDispatcher::adjust_screen_gamma_qt(double gamma)
{
sessioniface->call("adjust_screen_gamma", gamma);
}
double SessionDispatcher::get_screen_gamma_qt()
{
QDBusReply reply = sessioniface->call("get_screen_gamma");
return reply.value();
}
QStringList SessionDispatcher::get_idle_delay_list_qt()
{
QDBusReply reply = sessioniface->call("get_idle_delay_list");
return reply.value();
}
QString SessionDispatcher::get_current_idle_delay_qt()
{
QDBusReply reply = sessioniface->call("get_current_idle_delay");
return QString::number(reply.value());
}
void SessionDispatcher::set_current_idle_delay_qt(int value)
{
sessioniface->call("set_current_idle_delay", value);
}
bool SessionDispatcher::get_lock_enabled_qt()
{
QDBusReply reply = sessioniface->call("get_lock_enabled");
return reply.value();
}
void SessionDispatcher::set_lock_enabled_qt(bool value)
{
sessioniface->call("set_lock_enabled", value);
}
QStringList SessionDispatcher::get_lock_delay_list_qt()
{
QDBusReply reply = sessioniface->call("get_lock_delay_list");
return reply.value();
}
QString SessionDispatcher::get_current_lock_delay_qt()
{
QDBusReply reply = sessioniface->call("get_current_lock_delay");
return QString::number(reply.value());
}
void SessionDispatcher::set_current_lock_delay_qt(int value)
{
sessioniface->call("set_current_lock_delay", value);
}
QStringList SessionDispatcher::get_sleep_timeout_list_qt()
{
QDBusReply reply = sessioniface->call("get_sleep_timeout_list");
return reply.value();
}
QString SessionDispatcher::get_current_critical_low_qt()
{
QDBusReply reply = sessioniface->call("get_current_critical_low");
return reply.value();
}
void SessionDispatcher::set_current_critical_low_qt(QString value)
{
sessioniface->call("set_current_critical_low", value);
}
QString SessionDispatcher::get_current_lid_battery_qt()
{
QDBusReply reply = sessioniface->call("get_current_lid_battery");
return reply.value();
}
void SessionDispatcher::set_current_lid_battery_qt(QString value)
{
sessioniface->call("set_current_lid_battery", value);
}
QString SessionDispatcher::get_current_lid_ac_qt()
{
QDBusReply reply = sessioniface->call("get_current_lid_ac");
return reply.value();
}
void SessionDispatcher::set_current_lid_ac_qt(QString value)
{
sessioniface->call("set_current_lid_ac", value);
}
QString SessionDispatcher::get_current_sleep_timeout_display_battery_qt()
{
QDBusReply reply = sessioniface->call("get_current_sleep_timeout_display_battery");
return QString::number(reply.value());
}
void SessionDispatcher::set_current_sleep_timeout_display_battery_qt(int value)
{
sessioniface->call("set_current_sleep_timeout_display_battery", value);
}
QString SessionDispatcher::get_current_sleep_timeout_display_ac_qt()
{
QDBusReply reply = sessioniface->call("get_current_sleep_timeout_display_ac");
return QString::number(reply.value());
}
void SessionDispatcher::set_current_sleep_timeout_display_ac_qt(int value)
{
sessioniface->call("set_current_sleep_timeout_display_ac", value);
}
QString SessionDispatcher::get_current_sleep_timeout_battery_qt()
{
QDBusReply reply = sessioniface->call("get_current_sleep_timeout_battery");
return QString::number(reply.value());
}
void SessionDispatcher::set_current_sleep_timeout_battery_qt(int value)
{
sessioniface->call("set_current_sleep_timeout_battery", value);
}
QString SessionDispatcher::get_current_sleep_timeout_ac_qt()
{
QDBusReply reply = sessioniface->call("get_current_sleep_timeout_ac");
return QString::number(reply.value());
}
void SessionDispatcher::set_current_sleep_timeout_ac_qt(int value)
{
sessioniface->call("set_current_sleep_timeout_ac", value);
}
QString SessionDispatcher::get_current_launcher_position_qt()
{
QDBusReply reply = sessioniface->call("get_current_launcher_position");
return reply.value();
// return QString();
}
QStringList SessionDispatcher::get_all_launcher_position_qt()
{
QDBusReply reply = sessioniface->call("get_all_launcher_position");
return reply.value();
// return QStringList();
}
bool SessionDispatcher::set_launcher_position_qt(QString position)
{
QDBusReply reply = sessioniface->call("set_launcher_position", position);
return reply.value();
}
// notify changes
void SessionDispatcher::handler_notify_boolean(QString key, bool value)
{
// if (key == "home-icon-visible")
// {
// qDebug() << "home-icon-visible->" << value;
// }
// qDebug() << key;
// qDebug() << value;
emit bool_value_notify(key, value);
}
void SessionDispatcher::handler_notify_int(QString key, int value)
{
emit int_value_notify(key, value);
}
void SessionDispatcher::handler_notify_double(QString key, double value)
{
emit double_value_notify(key, value);
}
void SessionDispatcher::handler_notify_string(QString key, QString value)
{
// if (key == "gtk-theme")
// {
// }
emit string_value_notify(key, value);
}
youker-assistant-3.0.2/dbusproxy/youkersystemdbus.cpp 0000664 0001750 0001750 00000037425 13600302431 021672 0 ustar feng feng /*
* Copyright (C) 2013 ~ 2015 National University of Defense Technology(NUDT) & Kylin Ltd.
*
* Authors:
* Kobe Lee xiangli@ubuntukylin.com/kobe24_lixiang@126.com
*
* 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; 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, see .
*/
#include "youkersystemdbus.h"
#include
#include
#include
#include
SystemDispatcher::SystemDispatcher(QObject *parent)
: QObject(parent)
{
systemiface = new QDBusInterface("com.kylin.assistant.systemdaemon",
"/com/kylin/assistant/systemdaemon",
"com.kylin.assistant.systemdaemon",
QDBusConnection::systemBus());
qDebug() << "Starting SystemDispatcher";
QObject::connect(systemiface,SIGNAL(quit_clean(bool)),this,SLOT(handler_interrupt_clean(bool))/*, Qt::QueuedConnection*/);
QObject::connect(systemiface,SIGNAL(clean_complete_onekey(QString)),this,SLOT(handler_clear_rubbish_main_onekey(QString))/*, Qt::QueuedConnection*/);
QObject::connect(systemiface,SIGNAL(clean_error_onekey(QString)),this,SLOT(handler_clear_rubbish_main_error(QString))/*, Qt::QueuedConnection*/);
QObject::connect(systemiface,SIGNAL(status_for_quick_clean(QString,QString)),this,SLOT(handler_status_for_quick_clean(QString,QString))/*, Qt::QueuedConnection*/);
QObject::connect(systemiface,SIGNAL(subpage_data_signal(QStringList)),this,SLOT(handlerCleanerSubPageDataSignal(QStringList)));
QObject::connect(systemiface,SIGNAL(subpage_status_signal(QString, QString)),this,SLOT(handlerCleanerSubPageStatusSignal(QString, QString)));
QObject::connect(systemiface,SIGNAL(subpage_error_signal(QString)),this,SLOT(handlerCleanerSubPageErrorSignal(QString)));
QObject::connect(systemiface,SIGNAL(youker_fetch_signal(QString, QStringList)),this,SIGNAL(get_fetch_signal(QString, QStringList)));
QObject::connect(systemiface,SIGNAL(youker_apt_signal(QString, QStringList)),this,SIGNAL(get_apt_signal(QString, QStringList)));
// QObject::connect(systemiface,SIGNAL(youker_fetch_signal(QString, QStringList)),this,SLOT(handlerFetchSignal(QString, QStringList)));
// QObject::connect(systemiface,SIGNAL(youker_apt_signal(QString, QStringList)),this,SLOT(handlerAptSignal(QString, QStringList)));
// emit this->dbusInitFinished();
/*thread = new KThread(this);
clean_thread = new KThread(this);*/
}
SystemDispatcher::~SystemDispatcher() {
/*thread->terminate();
thread->wait();
if(thread != NULL) {
delete thread;
thread = NULL;
}
clean_thread->terminate();
clean_thread->wait();
if(clean_thread != NULL) {
delete clean_thread;
clean_thread = NULL;
}*/
this->exit_qt();
if (systemiface != NULL) {
delete systemiface;
systemiface = NULL;
}
}
//void SystemDispatcher::handlerFetchSignal(QString msg_type, QStringList msg)
//{
// qDebug() << "fecth----->" << msg_type;
// qDebug() << msg;
//}
//void SystemDispatcher::handlerAptSignal(QString msg_type, QStringList msg)
//{
// qDebug() << "apt----->" << msg_type;
// qDebug() << msg;
//}
void SystemDispatcher::adjust_cpufreq_scaling_governer_qt(QString value)
{
systemiface->call("adjust_cpufreq_scaling_governer", value);
}
QStringList SystemDispatcher::get_cpufreq_scaling_governer_list_qt()
{
QDBusReply reply = systemiface->call("get_cpufreq_scaling_governer_list");
return reply.value();
}
QString SystemDispatcher::get_current_cpufreq_scaling_governer_qt()
{
QDBusReply reply = systemiface->call("get_current_cpufreq_scaling_governer");
return reply.value();
}
//void SystemDispatcher::handlerCleanerSubPageDataSignal(QStringList data)
//{
// emit this->tellCleanerMainData(data);
//}
bool SystemDispatcher::update_myself()
{
/*QStringList tmp;
QMap data;
QEventLoop q;
KThread *apt_thread = new KThread(this);
// connect(apt_thread, SIGNAL(finished()), apt_thread, SLOT(deleteLater()));
apt_thread->initValues(data, tmp, systemiface, "install");
apt_thread->start();
q.exec();
if(apt_thread->isFinished()){
q.quit();
}*/
return true;
// QDBusReply reply = systemiface->call("install", "kylin-assistant");
// return reply.value();
}
bool SystemDispatcher::update_source()
{
/*QStringList tmp;
QMap data;
QEventLoop q;
KThread *source_thread = new KThread(this);
// connect(source_thread, SIGNAL(finished()), source_thread, SLOT(deleteLater()));
source_thread->initValues(data, tmp, systemiface, "update");
source_thread->start();
q.exec();
if(source_thread->isFinished()){
q.quit();
}*/
return true;
}
bool SystemDispatcher::copy_file_qt(QString filename)
{
QDBusReply reply = systemiface->call("copy_file", filename);
return reply.value();
}
bool SystemDispatcher::delete_file_qt(QString filename)
{
QDBusReply reply = systemiface->call("delete_file", filename);
return reply.value();
}
//系统清理
void SystemDispatcher::cleanAllSelectItems(QMap selectMap)
{
systemiface->call("remove_select_items", selectMap);
/*if (clean_thread->isRunning()) {
qDebug() << "clean_thread is running......";
}
else {
// if(clean_thread == NULL) {
// qDebug() << "clean_thread is null, ready to run......";
// }
// else
// qDebug() << "clean_thread is not null, ready to run......";
QStringList tmp;
QEventLoop q;
clean_thread->initValues(selectMap, tmp, systemiface, "remove_select_items");
clean_thread->start();
q.exec();
if(clean_thread->isFinished()){
q.quit();
}
}
// QElapsedTimer et;
// et.start();
// while(et.elapsed()<300)
// QCoreApplication::processEvents();*/
}
//void SystemDispatcher::kill_root_process_qt(QString pid) {
// systemiface->call("kill_root_process", pid);
//}
bool SystemDispatcher::kill_uk_process_qt() {
QDBusReply reply = systemiface->call("kill_uk_process");
return reply.value();
}
bool SystemDispatcher::set_cursor_theme_with_root_qt(QString theme) {
QDBusReply reply = systemiface->call("set_cursor_theme_with_root", theme);
return reply.value();
}
QString SystemDispatcher::get_os_name_qt()
{
QDBusReply reply = systemiface->call("get_os_name");
return reply.value();
}
QMap SystemDispatcher::get_computer_info_qt()
{
QMap value;
QDBusReply > reply = systemiface->call("get_computer_info");
if (reply.isValid()) {
value = reply.value();
return value;
}
else {
qDebug() << "get computer info failed!";
// QMap value;
// value.insert("kylinkobe", "kylinkobe");
return value;
}
}
bool SystemDispatcher::judge_sensors_exists_qt() {
QDBusReply reply = systemiface->call("judge_sensors_exists_hb");
return reply.value();
}
QMap SystemDispatcher::get_sensor_info_qt()
{
/*QMap value;
value.insert("IN0", "0.75V");
value.insert("IN2", "1.0V");
value.insert("IN3", "1.5V");
value.insert("IN5", "1.8V");
value.insert("IN6", "2.5V/2");
value.insert("TR1", "3.3V/2");
value.insert("TR2", "5V/3");
value.insert("TR3", "12V/12");
value.insert("TR4", "1.0V");
value.insert("TR5", "45℃");
value.insert("TR6", "50℃");
value.insert("FANIN1", "1800");
return value;*/
QMap value;
QDBusReply > reply = systemiface->call("get_sensor_info");
if (reply.isValid()) {
value = reply.value();
return value;
}
else {
// QMap value;
// value.insert("kylinkobe", "kylinkobe");
return value;
}
}
QMap SystemDispatcher::get_cpu_info_qt()
{
QMap value;
QDBusReply > reply = systemiface->call("get_cpu_info");
if (reply.isValid()) {
value = reply.value();
return value;
}
else {
qDebug() << "get cpu info failed!";
// QMap value;
// value.insert("kylinkobe", "kylinkobe");
return value;
}
}
QMap SystemDispatcher::get_memory_info_qt()
{
QMap value;
QDBusReply > reply = systemiface->call("get_memory_info");
if (reply.isValid()) {
value = reply.value();
return value;
}
else {
qDebug() << "get memory info failed!";
// QMap value;
// value.insert("kylinkobe", "kylinkobe");
return value;
}
}
QMap SystemDispatcher::get_board_info_qt()
{
QMap value;
QDBusReply > reply = systemiface->call("get_board_info");
if (reply.isValid()) {
value = reply.value();
return value;
}
else {
qDebug() << "get board info failed!";
// QMap value;
// value.insert("kylinkobe", "kylinkobe");
return value;
}
}
QMap SystemDispatcher::get_harddisk_info_qt()
{
QMap value;
QDBusReply > reply = systemiface->call("get_harddisk_info");
if (reply.isValid()) {
value = reply.value();
return value;
}
else {
qDebug() << "get harddisk info failed!";
// QMap value;
// value.insert("kylinkobe", "kylinkobe");
return value;
}
}
QMap SystemDispatcher::get_networkcard_info_qt()
{
QMap value;
QDBusReply > reply = systemiface->call("get_networkcard_info");
if (reply.isValid()) {
value = reply.value();
return value;
}
else {
qDebug() << "get networkcard info failed!";
// QMap value;
// value.insert("kylinkobe", "kylinkobe");
return value;
}
}
QMap SystemDispatcher::get_monitor_info_qt()
{
QMap value;
QDBusReply > reply = systemiface->call("get_monitor_info");
if (reply.isValid()) {
value = reply.value();
return value;
}
else {
qDebug() << "get monitor info failed!";
// QMap value;
// value.insert("kylinkobe", "kylinkobe");
return value;
}
}
QMap SystemDispatcher::get_cdrom_info_qt()
{
QMap value;
QDBusReply > reply = systemiface->call("get_cdrom_info");
if (reply.isValid()) {
value = reply.value();
return value;
}
else {
qDebug() << "get cdrom info failed!";
// QMap value;
// value.insert("kylinkobe", "kylinkobe");
return value;
}
}
QMap