Changeset View
Changeset View
Standalone View
Standalone View
tabbox/tabbox.cpp
Show First 20 Lines • Show All 815 Lines • ▼ Show 20 Line(s) | 815 | if (!ok) | |||
---|---|---|---|---|---|
816 | continue; | 816 | continue; | ||
817 | borders->append(ElectricBorder(i)); | 817 | borders->append(ElectricBorder(i)); | ||
818 | ScreenEdges::self()->reserve(ElectricBorder(i), this, "toggle"); | 818 | ScreenEdges::self()->reserve(ElectricBorder(i), this, "toggle"); | ||
819 | } | 819 | } | ||
820 | borders = &m_borderAlternativeActivate; | 820 | borders = &m_borderAlternativeActivate; | ||
821 | borderConfig = QStringLiteral("BorderAlternativeActivate"); | 821 | borderConfig = QStringLiteral("BorderAlternativeActivate"); | ||
822 | } | 822 | } | ||
823 | 823 | | |||
824 | auto touchConfig = [this, config] (const QString &key, QHash<ElectricBorder, QAction *> &actions, TabBoxMode mode) { | 824 | auto touchConfig = [this, config] (const QString &key, QHash<ElectricBorder, QAction *> &actions, TabBoxMode mode, const QStringList &defaults = QStringList{}) { | ||
825 | // fist erase old config | 825 | // fist erase old config | ||
826 | for (auto it = actions.begin(); it != actions.end(); ) { | 826 | for (auto it = actions.begin(); it != actions.end(); ) { | ||
827 | delete it.value(); | 827 | delete it.value(); | ||
828 | it = actions.erase(it); | 828 | it = actions.erase(it); | ||
829 | } | 829 | } | ||
830 | // now new config | 830 | // now new config | ||
831 | const QStringList list = config.readEntry(key, QStringList()); | 831 | const QStringList list = config.readEntry(key, defaults); | ||
832 | for (const auto &s : list) { | 832 | for (const auto &s : list) { | ||
833 | bool ok; | 833 | bool ok; | ||
834 | const int i = s.toInt(&ok); | 834 | const int i = s.toInt(&ok); | ||
835 | if (!ok) { | 835 | if (!ok) { | ||
836 | continue; | 836 | continue; | ||
837 | } | 837 | } | ||
838 | QAction *a = new QAction(this); | 838 | QAction *a = new QAction(this); | ||
839 | connect(a, &QAction::triggered, this, std::bind(&TabBox::toggleMode, this, mode)); | 839 | connect(a, &QAction::triggered, this, std::bind(&TabBox::toggleMode, this, mode)); | ||
840 | ScreenEdges::self()->reserveTouch(ElectricBorder(i), a); | 840 | ScreenEdges::self()->reserveTouch(ElectricBorder(i), a); | ||
841 | actions.insert(ElectricBorder(i), a); | 841 | actions.insert(ElectricBorder(i), a); | ||
842 | } | 842 | } | ||
843 | }; | 843 | }; | ||
844 | touchConfig(QStringLiteral("TouchBorderActivate"), m_touchActivate, TabBoxWindowsMode); | 844 | touchConfig(QStringLiteral("TouchBorderActivate"), m_touchActivate, TabBoxWindowsMode, QStringList{QString::number(int(ElectricLeft))}); | ||
845 | touchConfig(QStringLiteral("TouchBorderAlternativeActivate"), m_touchAlternativeActivate, TabBoxWindowsAlternativeMode); | 845 | touchConfig(QStringLiteral("TouchBorderAlternativeActivate"), m_touchAlternativeActivate, TabBoxWindowsAlternativeMode); | ||
846 | } | 846 | } | ||
847 | 847 | | |||
848 | void TabBox::loadConfig(const KConfigGroup& config, TabBoxConfig& tabBoxConfig) | 848 | void TabBox::loadConfig(const KConfigGroup& config, TabBoxConfig& tabBoxConfig) | ||
849 | { | 849 | { | ||
850 | tabBoxConfig.setClientDesktopMode(TabBoxConfig::ClientDesktopMode( | 850 | tabBoxConfig.setClientDesktopMode(TabBoxConfig::ClientDesktopMode( | ||
851 | config.readEntry<int>("DesktopMode", TabBoxConfig::defaultDesktopMode()))); | 851 | config.readEntry<int>("DesktopMode", TabBoxConfig::defaultDesktopMode()))); | ||
852 | tabBoxConfig.setClientActivitiesMode(TabBoxConfig::ClientActivitiesMode( | 852 | tabBoxConfig.setClientActivitiesMode(TabBoxConfig::ClientActivitiesMode( | ||
▲ Show 20 Lines • Show All 858 Lines • Show Last 20 Lines |