forked from qt-creator/qt-creator
LocalProcessList: Disable the Qt Creator process (Regression).
Prevent the user from shooting themselves in the foot. Change-Id: I67344b02fea5c19aa7f3db5b1c2c611c58e8bbf8 Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
@@ -40,6 +40,7 @@
|
||||
#include <signal.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
@@ -92,6 +93,7 @@ static QString imageName(DWORD processId)
|
||||
|
||||
LocalProcessList::LocalProcessList(const IDevice::ConstPtr &device, QObject *parent)
|
||||
: DeviceProcessList(device, parent)
|
||||
, m_myPid(GetCurrentProcessId())
|
||||
{
|
||||
}
|
||||
|
||||
@@ -135,6 +137,7 @@ void LocalProcessList::doKillProcess(const DeviceProcess &process)
|
||||
#ifdef Q_OS_UNIX
|
||||
LocalProcessList::LocalProcessList(const IDevice::ConstPtr &device, QObject *parent)
|
||||
: DeviceProcessList(device, parent)
|
||||
, m_myPid(getpid())
|
||||
{}
|
||||
|
||||
static bool isUnixProcessId(const QString &procname)
|
||||
@@ -241,5 +244,13 @@ void LocalProcessList::reportDelayedKillStatus()
|
||||
}
|
||||
#endif // QT_OS_UNIX
|
||||
|
||||
Qt::ItemFlags LocalProcessList::flags(const QModelIndex &index) const
|
||||
{
|
||||
Qt::ItemFlags flags = DeviceProcessList::flags(index);
|
||||
if (index.isValid() && at(index.row()).pid == m_myPid)
|
||||
flags &= ~(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
|
||||
return flags;
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace RemoteLinux
|
||||
|
@@ -47,23 +47,24 @@ class LocalProcessList : public DeviceProcessList
|
||||
|
||||
public:
|
||||
LocalProcessList(const IDevice::ConstPtr &device, QObject *parent = 0);
|
||||
virtual Qt::ItemFlags flags(const QModelIndex &index) const;
|
||||
|
||||
private:
|
||||
void doUpdate();
|
||||
void doKillProcess(const DeviceProcess &process);
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
private slots:
|
||||
#if defined(Q_OS_WIN)
|
||||
void handleWindowsUpdate();
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_UNIX
|
||||
private slots:
|
||||
#elif defined(Q_OS_UNIX)
|
||||
void reportDelayedKillStatus();
|
||||
void updateUsingProc();
|
||||
void updateUsingPs();
|
||||
#endif
|
||||
|
||||
private:
|
||||
const qint64 m_myPid;
|
||||
#ifdef Q_OS_UNIX
|
||||
QString m_error;
|
||||
#endif
|
||||
};
|
||||
|
Reference in New Issue
Block a user