From: Ivailo Monev Date: Tue, 27 Jan 2015 03:30:26 +0000 (+0000) Subject: kuassel: remove mac and windows code X-Git-Tag: 4.22.0~1120 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=263da31635ac4312741d15620572820593863738;p=kde%2Fkde-extraapps.git kuassel: remove mac and windows code --- diff --git a/kuassel/src/common/identity.cpp b/kuassel/src/common/identity.cpp index 084e27d5..105cb0e1 100644 --- a/kuassel/src/common/identity.cpp +++ b/kuassel/src/common/identity.cpp @@ -26,10 +26,6 @@ #include -#ifdef Q_OS_MAC -# include -# include "mac_utils.h" -#endif #ifdef Q_OS_UNIX # include @@ -37,12 +33,6 @@ # include #endif -#ifdef Q_OS_WIN -# include -# include -# define SECURITY_WIN32 -# include -#endif INIT_SYNCABLE_OBJECT(Identity) Identity::Identity(IdentityId id, QObject *parent) @@ -80,24 +70,6 @@ Identity::Identity(const Identity &other, QObject *parent) } -#ifdef Q_OS_WIN -#ifdef UNICODE -QString tcharToQString(TCHAR *tchar) -{ - return QString::fromUtf16(reinterpret_cast(tchar)); -} - - -#else -QString tcharToQString(TCHAR *tchar) -{ - return QString::fromLocal8Bit(tchar); -} - - -#endif - -#endif void Identity::init() { setObjectName(QString::number(id().toInt())); @@ -109,12 +81,7 @@ QString Identity::defaultNick() { QString nick = QString("quassel%1").arg(qrand() & 0xff); // FIXME provide more sensible default nicks -#ifdef Q_OS_MAC - QString shortUserName = CFStringToQString(CSCopyUserName(true)); - if (!shortUserName.isEmpty()) - nick = shortUserName; - -#elif defined(Q_OS_UNIX) +#if defined(Q_OS_UNIX) QString userName; struct passwd *pwd = getpwuid(getuid()); if (pwd) @@ -122,19 +89,6 @@ QString Identity::defaultNick() if (!userName.isEmpty()) nick = userName; -#elif defined(Q_OS_WIN) - TCHAR infoBuf[128]; - DWORD bufCharCount = 128; - //if(GetUserNameEx(/* NameSamCompatible */ 1, infoBuf, &bufCharCount)) - if (GetUserNameEx(NameSamCompatible, infoBuf, &bufCharCount)) { - QString nickName(tcharToQString(infoBuf)); - int lastBs = nickName.lastIndexOf('\\'); - if (lastBs != -1) { - nickName = nickName.mid(lastBs + 1); - } - if (!nickName.isEmpty()) - nick = nickName; - } #endif // cleaning forbidden characters from nick @@ -148,10 +102,7 @@ QString Identity::defaultRealName() { QString generalDefault = i18n("Kuassel User"); -#ifdef Q_OS_MAC - return CFStringToQString(CSCopyUserName(false)); - -#elif defined(Q_OS_UNIX) +#if defined(Q_OS_UNIX) QString realName; struct passwd *pwd = getpwuid(getuid()); if (pwd) @@ -161,13 +112,6 @@ QString Identity::defaultRealName() else return generalDefault; -#elif defined(Q_OS_WIN) - TCHAR infoBuf[128]; - DWORD bufCharCount = 128; - if (GetUserName(infoBuf, &bufCharCount)) - return tcharToQString(infoBuf); - else - return generalDefault; #else return generalDefault; #endif diff --git a/kuassel/src/common/settings.cpp b/kuassel/src/common/settings.cpp index d89b8500..056e01ae 100644 --- a/kuassel/src/common/settings.cpp +++ b/kuassel/src/common/settings.cpp @@ -27,11 +27,7 @@ const int VERSION = 1; QHash Settings::settingsCache; QHash Settings::settingsChangeNotifier; -#ifdef Q_OS_MAC -# define create_qsettings QSettings s(QCoreApplication::organizationDomain(), appName) -#else # define create_qsettings QSettings s(fileName(), format()) -#endif // Settings::Settings(QString group_, QString appName_) // : group(group_), diff --git a/kuassel/src/common/settings.h b/kuassel/src/common/settings.h index 4f556d79..2b4fb027 100644 --- a/kuassel/src/common/settings.h +++ b/kuassel/src/common/settings.h @@ -76,11 +76,7 @@ protected: private: inline QSettings::Format format() { -#ifdef Q_OS_WIN - return QSettings::IniFormat; -#else return QSettings::NativeFormat; -#endif } diff --git a/kuassel/src/core/core.cpp b/kuassel/src/core/core.cpp index f33741ac..a8ecba36 100644 --- a/kuassel/src/core/core.cpp +++ b/kuassel/src/core/core.cpp @@ -37,12 +37,8 @@ // migration related #include -#ifdef Q_OS_WIN -# include -#else # include # include -#endif /* Q_OS_WIN */ #ifdef HAVE_UMASK # include @@ -97,26 +93,14 @@ Core::Core() // FIXME: MIGRATION 0.3 -> 0.4: Move database and core config to new location // Move settings, note this does not delete the old files -#ifdef Q_OS_MAC - QSettings newSettings("quassel-irc.org", "quasselcore"); -#else -# ifdef Q_OS_WIN - QSettings::Format format = QSettings::IniFormat; -# else QSettings::Format format = QSettings::NativeFormat; -# endif QString newFilePath = Quassel::configDirPath() + "quasselcore" + ((format == QSettings::NativeFormat) ? QLatin1String(".conf") : QLatin1String(".ini")); QSettings newSettings(newFilePath, format); -#endif /* Q_OS_MAC */ if (newSettings.value("Config/Version").toUInt() == 0) { -# ifdef Q_OS_MAC - QString org = "quassel-irc.org"; -# else QString org = "Quassel Project"; -# endif QSettings oldSettings(org, "Quassel Core"); if (oldSettings.allKeys().count()) { qWarning() << "\n\n*** IMPORTANT: Config and data file locations have changed. Attempting to auto-migrate your core settings..."; @@ -125,14 +109,7 @@ Core::Core() newSettings.setValue("Config/Version", 1); qWarning() << "* Your core settings have been migrated to" << newSettings.fileName(); -#ifndef Q_OS_MAC /* we don't need to move the db and cert for mac */ -#ifdef Q_OS_WIN - QString quasselDir = qgetenv("APPDATA") + "/quassel/"; -#elif defined Q_OS_MAC - QString quasselDir = QDir::homePath() + "/Library/Application Support/Quassel/"; -#else QString quasselDir = QDir::homePath() + "/.quassel/"; -#endif QFileInfo info(Quassel::configDirPath() + "quassel-storage.sqlite"); if (!info.exists()) { @@ -156,7 +133,6 @@ Core::Core() else qWarning() << "!!! Moving your certificate has failed. Please move it manually into" << Quassel::configDirPath(); } -#endif /* !Q_OS_MAC */ qWarning() << "*** Migration completed.\n\n"; } } @@ -933,21 +909,6 @@ QVariantMap Core::promptForSettings(const Storage *storage) } -#ifdef Q_OS_WIN -void Core::stdInEcho(bool on) -{ - HANDLE hStdin = GetStdHandle(STD_INPUT_HANDLE); - DWORD mode = 0; - GetConsoleMode(hStdin, &mode); - if (on) - mode |= ENABLE_ECHO_INPUT; - else - mode &= ~ENABLE_ECHO_INPUT; - SetConsoleMode(hStdin, mode); -} - - -#else void Core::stdInEcho(bool on) { termios t; @@ -960,4 +921,3 @@ void Core::stdInEcho(bool on) } -#endif /* Q_OS_WIN */ diff --git a/kuassel/src/core/coreapplication.cpp b/kuassel/src/core/coreapplication.cpp index 2ea44f85..e7ecdf0f 100644 --- a/kuassel/src/core/coreapplication.cpp +++ b/kuassel/src/core/coreapplication.cpp @@ -67,9 +67,6 @@ bool CoreApplicationInternal::init() CoreApplication::CoreApplication(int &argc, char **argv) : QCoreApplication(argc, argv), Quassel() { -#ifdef Q_OS_MAC - disableCrashhandler(); -#endif /* Q_OS_MAC */ setRunMode(Quassel::CoreOnly); _internal = new CoreApplicationInternal(); diff --git a/kuassel/src/qtui/coreconfigwizard.cpp b/kuassel/src/qtui/coreconfigwizard.cpp index adfe4d21..2ba8936c 100644 --- a/kuassel/src/qtui/coreconfigwizard.cpp +++ b/kuassel/src/qtui/coreconfigwizard.cpp @@ -53,9 +53,7 @@ CoreConfigWizard::CoreConfigWizard(CoreConnection *connection, const QListaddAction("BindJumpKey0", new Action(i18n("Set Quick Access #0"), coll, this, SLOT(bindJumpKey()), QKeySequence(bindModifier + Qt::Key_0)))->setProperty("Index", 0); @@ -903,9 +898,6 @@ void MainWin::setupToolBars() connect(_nickListWidget, SIGNAL(nickSelectionChanged(QModelIndexList)), QtUi::toolBarActionProvider(), SLOT(nickSelectionChanged(QModelIndexList))); -#ifdef Q_OS_MAC - setUnifiedTitleAndToolBarOnMac(true); -#endif _mainToolBar = new KToolBar("MainToolBar", this, Qt::TopToolBarArea, false, true, true); _mainToolBar->setWindowTitle(i18n("Main Toolbar")); @@ -914,23 +906,11 @@ void MainWin::setupToolBars() QtUi::toolBarActionProvider()->addActions(_mainToolBar, ToolBarActionProvider::MainToolBar); _toolbarMenu->addAction(_mainToolBar->toggleViewAction()); -#ifdef Q_OS_MAC - QtUiSettings uiSettings; - - bool visible = uiSettings.value("ShowMainToolBar", QVariant(true)).toBool(); - _mainToolBar->setVisible(visible); - connect(_mainToolBar, SIGNAL(visibilityChanged(bool)), this, SLOT(saveMainToolBarStatus(bool))); -#endif } void MainWin::saveMainToolBarStatus(bool enabled) { -#ifdef Q_OS_MAC - QtUiSettings uiSettings; - uiSettings.setValue("ShowMainToolBar", enabled); -#else Q_UNUSED(enabled); -#endif } diff --git a/kuassel/src/qtui/settingspages/appearancesettingspage.cpp b/kuassel/src/qtui/settingspages/appearancesettingspage.cpp index 1172fc4c..55d62c1b 100644 --- a/kuassel/src/qtui/settingspages/appearancesettingspage.cpp +++ b/kuassel/src/qtui/settingspages/appearancesettingspage.cpp @@ -38,9 +38,6 @@ AppearanceSettingsPage::AppearanceSettingsPage(QWidget *parent) { ui.setupUi(this); -#ifdef Q_OS_MAC - ui.minimizeOnClose->hide(); -#endif #ifdef QT_NO_SYSTEMTRAYICON ui.useSystemTrayIcon->hide(); #endif diff --git a/kuassel/src/qtui/taskbarnotificationbackend.cpp b/kuassel/src/qtui/taskbarnotificationbackend.cpp index ba6ff80e..b16b273f 100644 --- a/kuassel/src/qtui/taskbarnotificationbackend.cpp +++ b/kuassel/src/qtui/taskbarnotificationbackend.cpp @@ -79,11 +79,7 @@ SettingsPage *TaskbarNotificationBackend::createConfigWidget() const TaskbarNotificationBackend::ConfigWidget::ConfigWidget(QWidget *parent) : SettingsPage("Internal", "TaskbarNotification", parent) { QHBoxLayout *layout = new QHBoxLayout(this); -#ifdef Q_OS_MAC - layout->addWidget(enabledBox = new QCheckBox(i18n("Activate dock entry, timeout:"), this)); -#else layout->addWidget(enabledBox = new QCheckBox(i18n("Mark taskbar entry, timeout:"), this)); -#endif enabledBox->setIcon(KIcon("flag-blue")); enabledBox->setEnabled(true); diff --git a/kuassel/src/uisupport/graphicalui.cpp b/kuassel/src/uisupport/graphicalui.cpp index 1e7da8bf..1a4bb003 100644 --- a/kuassel/src/uisupport/graphicalui.cpp +++ b/kuassel/src/uisupport/graphicalui.cpp @@ -47,17 +47,11 @@ GraphicalUi::GraphicalUi(QObject *parent) : AbstractUi(parent) Q_ASSERT(!_instance); _instance = this; -#ifdef Q_OS_WIN - _dwTickCount = 0; -#endif } void GraphicalUi::init() { -#ifdef Q_OS_WIN - mainWidget()->installEventFilter(this); -#endif } @@ -135,11 +129,6 @@ void GraphicalUi::disconnectedFromCore() bool GraphicalUi::eventFilter(QObject *obj, QEvent *event) { -#ifdef Q_OS_WIN - if (obj == mainWidget() && event->type() == QEvent::ActivationChange) { - _dwTickCount = GetTickCount(); - } -#endif return AbstractUi::eventFilter(obj, event); } diff --git a/kuassel/src/uisupport/graphicalui.h b/kuassel/src/uisupport/graphicalui.h index 59d06583..e80993be 100644 --- a/kuassel/src/uisupport/graphicalui.h +++ b/kuassel/src/uisupport/graphicalui.h @@ -28,9 +28,6 @@ class ContextMenuActionProvider; class ToolBarActionProvider; class UiStyle; -#ifdef Q_OS_WIN -# include -#endif class GraphicalUi : public AbstractUi { @@ -116,9 +113,6 @@ private: static UiStyle *_uiStyle; static bool _onAllDesktops; -#ifdef Q_OS_WIN - DWORD _dwTickCount; -#endif }; diff --git a/kuassel/src/uisupport/multilineedit.cpp b/kuassel/src/uisupport/multilineedit.cpp index d086d7b2..57917eec 100644 --- a/kuassel/src/uisupport/multilineedit.cpp +++ b/kuassel/src/uisupport/multilineedit.cpp @@ -295,11 +295,7 @@ void MultiLineEdit::keyPressEvent(QKeyEvent *event) if (event == QKeySequence::InsertLineSeparator) { #else -# ifdef Q_OS_MAC - if ((event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter) && event->modifiers() & Qt::META) { -# else if ((event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter) && event->modifiers() & Qt::SHIFT) { -# endif #endif if (_mode == SingleLine) { @@ -720,9 +716,6 @@ void MultiLineEdit::on_textChanged() msg += "...

"; QMessageBox question(QMessageBox::NoIcon, i18n("Paste Protection"), msg, QMessageBox::Yes|QMessageBox::No); question.setDefaultButton(QMessageBox::No); -#ifdef Q_OS_MAC - question.setWindowFlags(question.windowFlags() | Qt::Sheet); -#endif if (question.exec() != QMessageBox::Yes) return; }