yet more windows and mac code remove

This commit is contained in:
Ivailo Monev 2014-11-19 15:30:39 +00:00
parent 6f8472c60a
commit c7a2a17692
24 changed files with 3 additions and 223 deletions

View file

@ -873,13 +873,6 @@ KCmdLineArgsStatic::parseAllArgs()
{
KCmdLineArgs::usage(option.mid(5));
}
#ifdef Q_WS_MAC
// skip the finder -psn_* hint
else if (option.startsWith("psn_")) // krazy:exclude=strings
{
continue;
}
#endif
else if ((option == "version") || (option == "v"))
{
KCmdLineArgs::enable_i18n();

View file

@ -1101,41 +1101,9 @@ QStringList KStandardDirs::systemPaths( const QString& pstr )
return exePaths;
}
#ifdef Q_WS_MAC
static QString getBundle( const QString& path, bool ignore )
{
//kDebug(180) << "getBundle(" << path << ", " << ignore << ") called";
QFileInfo info;
QString bundle = path;
bundle += QLatin1String(".app/Contents/MacOS/") + bundle.section(QLatin1Char('/'), -1);
info.setFile( bundle );
FILE *file;
if (file = fopen(info.absoluteFilePath().toUtf8().constData(), "r")) {
fclose(file);
struct stat _stat;
if ((stat(info.absoluteFilePath().toUtf8().constData(), &_stat)) < 0) {
return QString();
}
if ( ignore || (_stat.st_mode & S_IXUSR) ) {
if ( ((_stat.st_mode & S_IFMT) == S_IFREG) || ((_stat.st_mode & S_IFMT) == S_IFLNK) ) {
//kDebug(180) << "getBundle(): returning " << bundle;
return bundle;
}
}
}
return QString();
}
#endif
static QString checkExecutable( const QString& path, bool ignoreExecBit )
{
#ifdef Q_WS_MAC
QString bundle = getBundle( path, ignoreExecBit );
if ( !bundle.isEmpty() ) {
//kDebug(180) << "findExe(): returning " << bundle;
return bundle;
}
#endif
QFileInfo info( path );
QFileInfo orig = info;
#if defined(Q_OS_DARWIN) || defined(Q_OS_MAC)
@ -1238,13 +1206,6 @@ int KStandardDirs::findAllExe( QStringList& list, const QString& appname,
p = (*it) + QLatin1Char('/');
p += appname;
#ifdef Q_WS_MAC
QString bundle = getBundle( p, (options & IgnoreExecBit) );
if ( !bundle.isEmpty() ) {
//kDebug(180) << "findExe(): returning " << bundle;
list.append( bundle );
}
#endif
info.setFile( p );

View file

@ -23,11 +23,7 @@
*/
#include "klocale.h"
#if defined Q_OS_MAC
#include "klocale_mac_p.h"
#else
#include "klocale_unix_p.h"
#endif
#include <QtCore/QDateTime>
#include <QtCore/QTextCodec>
@ -44,20 +40,12 @@
#include "common_helpers_p.h"
KLocale::KLocale(const QString &catalog, KSharedConfig::Ptr config)
#if defined Q_OS_MAC
: d(new KLocaleMacPrivate(this, catalog, config))
#else
: d(new KLocaleUnixPrivate(this, catalog, config))
#endif
{
}
KLocale::KLocale(const QString& catalog, const QString &language, const QString &country, KConfig *config)
#if defined Q_OS_MAC
: d(new KLocaleMacPrivate(this, catalog, language, country, config))
#else
: d(new KLocaleUnixPrivate(this, catalog, language, country, config))
#endif
{
}

View file

@ -84,14 +84,12 @@ protected Q_SLOTS:
void emitSigFoo()
{
emit sigFoo();
#ifndef Q_OS_MAC
// Mac currently uses the unix event loop (not glib) which
// has issues and blocks in nested event loops such as the
// one triggered by the below. Since this is a limitation
// of Qt and working around it here doesn't invalidate the
// actual test case, let's do that.
QTest::qWait(10);
#endif
}
Q_SIGNALS:

View file

@ -220,19 +220,13 @@ void KStandarddirsTest::testFindExe()
// findExe with a result in bin
const QString kdeinit = KGlobal::dirs()->findExe( "kdeinit4" );
QVERIFY( !kdeinit.isEmpty() );
#ifdef Q_OS_MAC
QVERIFY2(kdeinit.endsWith("kdeinit4", PATH_SENSITIVITY), qPrintable(kdeinit));
#else
QVERIFY2(kdeinit.endsWith("bin/kdeinit4" EXT, PATH_SENSITIVITY), qPrintable(kdeinit));
#endif
#ifndef Q_OS_MAC // kdeinit4 is a bundle on Mac, so the below doesn't work
// Check the "exe" resource too
QString kdeinitPath1 = KGlobal::dirs()->realFilePath(kdeinit);
QString kdeinitPath2 = KGlobal::dirs()->locate( "exe", "kdeinit4" );
QCOMPARE_PATHS( kdeinitPath1, kdeinitPath2 );
#endif
#ifdef Q_OS_UNIX
// findExe with a result in libexec

View file

@ -457,9 +457,6 @@ void KApplicationPrivate::init(bool GUIenabled)
::exit(127);
}
#ifdef Q_WS_MAC
mac_initialize_dbus();
#endif
KApplication::KApp = q;
@ -572,20 +569,6 @@ void KApplicationPrivate::init(bool GUIenabled)
q, SLOT(_k_slot_KToolInvocation_hook(QStringList&,QByteArray&)));
}
#ifdef Q_WS_MAC
if (q->type() == KApplication::GuiClient) {
// This is a QSystemTrayIcon instead of K* because we can't be sure q is a QWidget
QSystemTrayIcon *trayIcon; //krazy:exclude=qclasses
if (QSystemTrayIcon::isSystemTrayAvailable()) //krazy:exclude=qclasses
{
trayIcon = new QSystemTrayIcon(q); //krazy:exclude=qclasses
trayIcon->setIcon(q->windowIcon());
/* it's counter-intuitive, but once you do setIcon it's already set the
dock icon... ->show actually shows an icon in the menu bar too :P */
// trayIcon->show();
}
}
#endif
qRegisterMetaType<KUrl>();
qRegisterMetaType<KUrl::List>();

View file

@ -372,18 +372,10 @@ struct KFontData
// NOTE: keep in sync with kdebase/workspace/kcontrol/fonts/fonts.cpp
static const char GeneralId[] = "General";
static const char DefaultFont[] = "Sans Serif";
#ifdef Q_WS_MAC
static const char DefaultMacFont[] = "Lucida Grande";
#endif
static const KFontData DefaultFontData[KGlobalSettingsData::FontTypesCount] =
{
#ifdef Q_WS_MAC
{ GeneralId, "font", DefaultMacFont, 13, -1, QFont::SansSerif },
{ GeneralId, "fixed", "Monaco", 10, -1, QFont::TypeWriter },
{ GeneralId, "toolBarFont", DefaultMacFont, 11, -1, QFont::SansSerif },
{ GeneralId, "menuFont", DefaultMacFont, 13, -1, QFont::SansSerif },
#elif defined(Q_WS_MAEMO_5) || defined(MEEGO_EDITION_HARMATTAN)
#if defined(Q_WS_MAEMO_5) || defined(MEEGO_EDITION_HARMATTAN)
{ GeneralId, "font", DefaultFont, 16, -1, QFont::SansSerif },
{ GeneralId, "fixed", "Monospace", 16, -1, QFont::TypeWriter },
{ GeneralId, "toolBarFont", DefaultFont, 16, -1, QFont::SansSerif },

View file

@ -42,11 +42,6 @@ public:
{
return x11Event(e);
}
#elif defined(Q_WS_MAC)
bool publicMacEvent(EventHandlerCallRef caller, EventRef event)
{
return macEvent(caller, event);
}
#endif
};
@ -99,18 +94,6 @@ bool KSystemEventFilterPrivate::filterEvent(void *message)
}
}
}
#elif defined(Q_WS_MAC)
// FIXME: untested
/* NSEvent *nsevt = static_cast<NSEvent*>(message);
// pass the event as long as it's not consumed
Q_FOREACH (const QWeakPointer<QWidget> &wp, m_filters) {
if (QWidget *w = wp.data()) {
if (static_cast<KEventHackWidget*>(w)->publicMacEvent(0, nsevt->eventRef)) {
return true;
}
}
}*/
#endif
}

View file

@ -270,11 +270,7 @@ void KNotification::Private::raiseWidget(QWidget *w)
if(w->isTopLevel())
{
w->raise();
#if defined(Q_WS_MAC)
w->activateWindow();
#else
KWindowSystem::activateWindow( w->winId() );
#endif
}
else
{

View file

@ -438,12 +438,10 @@ void KCrash::startProcess(int argc, const char *argv[], bool waitAndExit)
// This is done because it is dangerous to use fork() in the crash handler
// (there can be functions registered to be performed before fork(), for example handling
// of malloc locking, which doesn't work when malloc crashes because of heap corruption).
#ifndef Q_OS_MAC
// Fails on Apple OSX+KDE4, because kdeinit4 is using the wrong socket name.
if (!(s_flags & AlwaysDirectly)) {
startDirectly = !startProcessInternal(argc, argv, waitAndExit, false);
}
#endif
// If we can't reach kdeinit, we can still at least try to fork()
if (startDirectly) {

View file

@ -635,10 +635,7 @@ void KKeySequenceWidgetPrivate::updateShortcutDisplay()
if (modifierKeys) {
if (!s.isEmpty()) s.append(",");
if (modifierKeys & Qt::META) s += KKeyServer::modToStringUser(Qt::META) + '+';
#if defined(Q_WS_MAC)
if (modifierKeys & Qt::ALT) s += KKeyServer::modToStringUser(Qt::ALT) + '+';
if (modifierKeys & Qt::CTRL) s += KKeyServer::modToStringUser(Qt::CTRL) + '+';
#elif defined(Q_WS_X11)
#if defined(Q_WS_X11)
if (modifierKeys & Qt::CTRL) s += KKeyServer::modToStringUser(Qt::CTRL) + '+';
if (modifierKeys & Qt::ALT) s += KKeyServer::modToStringUser(Qt::ALT) + '+';
#endif

View file

@ -78,11 +78,7 @@ KStatusBar::KStatusBar( QWidget *parent )
// ...but on by default on OSX, else windows with a KStatusBar are not resizable at all (marijn)
KSharedConfig::Ptr config = KGlobal::config();
KConfigGroup group( config, QLatin1String("StatusBar style") );
#ifdef Q_WS_MAC
bool grip_enabled = group.readEntry(QLatin1String("SizeGripEnabled"), true);
#else
bool grip_enabled = group.readEntry(QLatin1String("SizeGripEnabled"), false);
#endif
setSizeGripEnabled(grip_enabled);
}

View file

@ -217,11 +217,6 @@ public:
private:
class Private;
Private * d; //krazy:exclude=dpointer (implicitly shared)
#ifdef Q_WS_MAC
// KWindowSystem needs access to the d-pointer
friend class KWindowSystem;
friend class KWindowSystemPrivate;
#endif
};
#endif // multiple inclusion guard

View file

@ -535,9 +535,6 @@ static pid_t launch(int argc, const char *_name, const char *args,
#endif
// find out this path before forking, doing it afterwards
// crashes on some platforms, notably OSX
#ifdef Q_WS_MAC
const QString bundlepath = s_instance->dirs()->findExe(QFile::decodeName(execpath));
#endif
d.errorMsg = 0;
d.fork = fork();
@ -599,14 +596,6 @@ static pid_t launch(int argc, const char *_name, const char *args,
QByteArray procTitle;
d.argv = (char **) malloc(sizeof(char *) * (argc+1));
d.argv[0] = (char *) _name;
#ifdef Q_WS_MAC
QString argvexe = s_instance->dirs()->findExe(QString::fromLatin1(d.argv[0]));
if (!argvexe.isEmpty()) {
QByteArray cstr = argvexe.toLocal8Bit();
kDebug(7016) << "kdeinit4: launch() setting argv: " << cstr.data();
d.argv[0] = strdup(cstr.data());
}
#endif
for (int i = 1; i < argc; i++)
{
d.argv[i] = (char *) args;
@ -675,10 +664,6 @@ static pid_t launch(int argc, const char *_name, const char *args,
setup_tty( tty );
QByteArray executable = execpath;
#ifdef Q_WS_MAC
if (!bundlepath.isEmpty())
executable = QFile::encodeName(bundlepath);
#endif
if (!executable.isEmpty())
execvp(executable, d.argv);

View file

@ -31,17 +31,6 @@
#include <QtCore/QLibrary>
#include <QtCore/QFile>
#if defined(Q_WS_WIN) || defined(Q_WS_MAC)
#define USE_KPROCESS_FOR_KIOSLAVES
#endif
#ifdef USE_KPROCESS_FOR_KIOSLAVES
#include <QtCore/QDir>
#include <QtCore/QProcess>
#include <QtCore/QStringList>
#include "kstandarddirs.h"
#endif
/* These are to link libkio even if 'smart' linker is used */
#include <kio/authinfo.h>
extern "C" KIO::AuthInfo* _kioslave_init_kio() { return new KIO::AuthInfo(); }
@ -65,43 +54,12 @@ int main(int argc, char **argv)
}
QLibrary lib(libpath);
#ifdef USE_KPROCESS_FOR_KIOSLAVES
qDebug("trying to load '%s'", qPrintable(libpath));
#endif
if ( !lib.load() || !lib.isLoaded() )
{
#ifdef USE_KPROCESS_FOR_KIOSLAVES
libpath = KStandardDirs::installPath("module") + QFileInfo(libpath).fileName();
lib.setFileName( libpath );
if(!lib.load() || !lib.isLoaded())
{
QByteArray kdedirs = qgetenv("KDEDIRS");
if (!kdedirs.size()) {
qDebug("not able to find '%s' because KDEDIRS environment variable is not set.\n"
"Set KDEDIRS to the KDE installation root dir and restart klauncher to fix this problem.",
qPrintable(libpath));
exit(1);
}
QString paths = QString::fromLocal8Bit(kdedirs);
QStringList pathlist = paths.split(';');
Q_FOREACH(const QString &path, pathlist) {
QString slave_path = path + QLatin1String("/lib/katana/") + QFileInfo(libpath).fileName();
qDebug("trying to load '%s'",slave_path.toLatin1().data());
lib.setFileName(slave_path);
if (lib.load() && lib.isLoaded() )
break;
}
if (!lib.isLoaded())
{
qWarning("could not open %s: %s", libpath.data(), qPrintable (lib.errorString()) );
exit(1);
}
}
#else
fprintf(stderr, "could not open %s: %s", qPrintable(libpath),
qPrintable (lib.errorString()) );
exit(1);
#endif
}
void* sym = lib.resolve("kdemain");
@ -111,7 +69,6 @@ int main(int argc, char **argv)
exit(1);
}
int (*func)(int, char *[]) = (int (*)(int, char *[])) sym;
exit( func(argc-1, argv+1)); /* Launch! */

View file

@ -655,11 +655,6 @@ KLauncher::requestStart(KLaunchRequest *request)
args << arg;
QString executable = request->name;
#ifdef Q_WS_MAC
const QString bundlepath = KStandardDirs::findExe(executable);
if (!bundlepath.isEmpty())
executable = bundlepath;
#endif
process->setProgram(executable,args);
process->start();

View file

@ -31,9 +31,6 @@
#include <fixx11h.h>
#endif
#if defined(Q_WS_WIN) || defined(Q_WS_MAC)
#define USE_KPROCESS_FOR_KIOSLAVES
#endif
#include <QtCore/QString>
#include <QtCore/QSocketNotifier>

View file

@ -82,13 +82,9 @@ KfsProcessController::KfsProcessController()
KfsProcessController::~KfsProcessController()
{
#ifndef Q_OS_MAC
/* not sure why, but this is causing lockups */
close( m_fd[0] );
close( m_fd[1] );
#else
#warning FIXME: why does close() freeze up destruction?
#endif
}

View file

@ -1773,11 +1773,7 @@ KFilePermissionsPropsPlugin::KFilePermissionsPropsPlugin( KPropertiesDialog *_pr
#ifdef HAVE_GETGROUPLIST
// pick the groups to which the user belongs
int groupCount = 0;
#ifdef Q_OS_MAC
QVarLengthArray<int> groups;
#else
QVarLengthArray<gid_t> groups;
#endif
if (getgrouplist(strUser, user->pw_gid, NULL, &groupCount) < 0) {
groups.resize(groupCount);
if (groups.data())

View file

@ -618,12 +618,8 @@ QPixmap KFileItemDelegate::Private::transition(const QPixmap &from, const QPixma
color.setAlphaF(amount);
// FIXME: Somehow this doesn't work on Mac OS..
#if defined(Q_OS_MAC)
const bool usePixmap = false;
#else
const bool usePixmap = from.paintEngine()->hasFeature(QPaintEngine::PorterDuff) &&
from.paintEngine()->hasFeature(QPaintEngine::BlendModes);
#endif
// If the native paint engine supports Porter/Duff compositing and CompositionMode_Plus
if (usePixmap)

View file

@ -651,8 +651,6 @@ static QString platform()
{
#if defined(Q_WS_X11)
return QL1S("X11");
#elif defined(Q_WS_MAC)
return QL1S("Macintosh");
#elif defined(Q_WS_S60)
return QL1S("Symbian");
#endif

View file

@ -206,16 +206,12 @@ void KPtyProcessTest::test_pty_signals()
void KPtyProcessTest::test_ctty()
{
#ifdef Q_OS_MAC
QSKIP("This test currently hangs on OSX", SkipSingle);
#else
KPtyProcess p;
p.setShellCommand("echo this is a test > /dev/tty");
p.execute(1000);
p.pty()->waitForReadyRead(1000);
QString output = p.pty()->readAll();
QCOMPARE(output, QLatin1String("this is a test\r\n"));
#endif
}
QTEST_KDEMAIN_CORE( KPtyProcessTest )

View file

@ -28,12 +28,8 @@
#include "xsyncbasedpoller.h"
#endif
#else
#ifdef Q_WS_MAC
#include "macpoller.h"
#else
#include "windowspoller.h"
#endif
#endif
#include <QWeakPointer>
#include <QSet>
@ -196,12 +192,8 @@ void KIdleTimePrivate::loadSystem()
poller = new XScreensaverBasedPoller();
#endif
#endif
#else
#ifdef Q_WS_MAC
poller = new MacPoller();
#else
poller = new WindowsPoller();
#endif
#endif
if (!poller.isNull()) {

View file

@ -21,9 +21,7 @@
#include "managerbase_p.h"
#include <stdlib.h>
#if !defined (Q_WS_WIN) && !defined (Q_OS_MAC)
#include <config-solid.h>
#endif
#include "backends/fakehw/fakemanager.h"