/usr/include/KF5/libkdepim/kcursorsaver.h is in libkf5libkdepim-dev 4:17.12.3-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | #ifndef kcursorsaver_h
#define kcursorsaver_h
#include <QCursor>
#include <QApplication>
namespace KPIM {
/**
* @short sets a cursor and makes sure it's restored on destruction
* Create a KCursorSaver object when you want to set the cursor.
* As soon as it gets out of scope, it will restore the original
* cursor.
*/
class KCursorSaver
{
public:
/// constructor taking QCursor shapes
explicit KCursorSaver(Qt::CursorShape shape)
{
QApplication::setOverrideCursor(QCursor(shape));
inited = true;
}
/// copy constructor. The right side won't restore the cursor
KCursorSaver(const KCursorSaver &rhs)
{
*this = rhs;
}
/// restore the cursor
~KCursorSaver()
{
if (inited) {
QApplication::restoreOverrideCursor();
}
}
/// call this to explitly restore the cursor
inline void restoreCursor(void)
{
QApplication::restoreOverrideCursor();
inited = false;
}
protected:
void operator=(const KCursorSaver &rhs)
{
inited = rhs.inited;
rhs.inited = false;
}
private:
mutable bool inited;
};
/**
* convenience functions
*/
namespace KBusyPtr {
inline KCursorSaver idle()
{
return KCursorSaver(Qt::ArrowCursor);
}
inline KCursorSaver busy()
{
return KCursorSaver(Qt::WaitCursor);
}
}
}
#endif /*kbusyptr_h_*/
|