# KShutdown - README

A graphical shutdown utility for Linux and Windows

© Konrad Twardowski

Visit KShutdown Home Page and Wiki for more info.

## Table of Contents

- KDE Build vs. Qt Build
- KDE Build @ Linux
- Qt Build @ Linux
- Qt Build @ Windows
- Qt Build @ Haiku
- Supported Functions/Platforms
- Compatibility
- Credits
- Support
- License (GPL)

## KDE Build vs. Qt Build

| KDE Build | Qt Build
Summary | A KShutdown version compiled using KDE4 libraries (super integration with KDE platform + extra features) | A KShutdown version compiled without KDE4 libraries (Qt only, for Xfce, GNOME, etc.)
Compilation Script | ./Setup-kde4.sh | ./Setup-qt4.sh
Required Libraries | libqtgui4, libqt4-dbus, libkworkspace4, base KDE libraries | libqtgui4, libqt4-dbus
Menu Shortcut Name | KShutdown | KShutdown/Qt
Default Program Location (after "make install") | /usr/bin/kshutdown | /usr/bin/kshutdown-qt
Dev Info
C++ #define | `KS_NATIVE_KDE` | `KS_PURE_QT`
Build System | CMake (CMakeLists.txt files) | QMake (src/src.pro file)
Language Translation System (input: po/*.po) | Gettext (output: build.tmp/po/*.mo) | Gettext (output: src/i18n/*.qm), kshutdown.qrc

See Supported Functions/Platforms table for more info.

## KDE Build @ Linux

### Minimal Requirements

1. KDE 4.7+
2. Qt 4.8+ or Qt 5.x

### Compilation & Installation

1. Additional requirements: installed `"kdelibs-dev"` package, CMake 2.4, and Gettext Utilities
2. To compile and install KShutdown run: `./Setup-kde4.sh`
3. To change the installation directory (prefix) run: `./Setup-kde4.sh "/your/prefix/dir"`
4. Clang support (an alternative C++ compiler):
   - `export CXX=/usr/bin/clang++`
   - `export CXXFLAGS=-march=i686` (in case of Illegal Instruction errors on some hardware)
   - Go to step 2.

### Common Errors

#### CMake Error at /usr/share/cmake-2.6/Modules/FindKDE4.cmake:72

    CMake Error at /usr/share/cmake-2.6/Modules/FindKDE4.cmake:72 (MESSAGE):
    ERROR: cmake/modules/FindKDE4Internal.cmake not found in
    ...;/usr/lib/kde4/share/kde4/apps

Install "kdelibs-dev" (sometimes called kdelibs5-dev) and "kdebase-workspace-dev" packages for your KDE version.

#### CMake Error at (...) Phonon library or includes NOT found!

This may happed after Ubuntu upgrade even if required Phonon files are already installed. [Solution]

#### "pushd: not found" error

Try to run `./Setup-kde4.sh` and `cd build.tmp; sudo make install` instead of `sudo sh Setup-kde4.sh`

### Compilation & Installation (alternative method; for geeks and nerds only)

BUILDTYPE can be `Release` or `Debug`. You can change the installation directory (prefix) by setting the `CMAKE_INSTALL_PREFIX` environment variable. To display default prefix for KDE applications, run `kde4-config --prefix`.

1. Create output directory: `mkdir build && cd build`
2. Generate Makefiles: `cmake -DCMAKE_BUILD_TYPE=BUILDTYPE -DCMAKE_INSTALL_PREFIX="/usr/local" ..`
3. Compile: `make`
4. Make coffee
5. Install: `make install`

## Qt Build @ Linux

Note: Some functions may be unavailable in this build. See Qt Build table for more info.

### Minimal Requirements

1. Qt 4.8+ or Qt 5.x (KDE libraries are not required)

### Compilation & Installation

1. To compile KShutdown run: `./Setup-qt4.sh`
2. Installation is not required
3. Clang support (an alternative C++ compiler):
   1. `cd src; qmake -spec /usr/share/qt4/mkspecs/unsupported/linux-clang/`
   2. `make`

### Using an alternate Qt version (Qt 5.1 example)

1. `cd src`
2. `/opt/Qt/5.1.0/gcc/bin/qmake`
3. `make`

## Qt Build @ Windows

Note: You can download a binary (already compiled) KShutdown version for Windows.

### Minimal Requirements (for compilation)

1. MinGW - Minimalist GNU for Windows
   - Download and launch MinGW Installer
   - Choose `C:\mingw` as the install directory (default)
   - Install C++ Compiler component
2. Qt libraries for Windows (minGW, LGPL version) 4.8+/5.x
3. Nullsoft Scriptable Install System (NSIS)
4. Windows XP/Vista/7/8 or compatible (including Wine)

### Compilation & Installation

- To compile and install KShutdown run: `Setup-qt4.bat` (this will rebuild both portable and installable version)
- To quick compile and test:
  1. Launch "Command Prompt" (`cmd.exe`)
  2. `cd your-kshutdown-source-dir\src`
  3. Run `c:\qt\<your-qt-version>\bin\qtvars.bat` (it should print Setting up a MinGW/Qt only environment...)
  4. Run `make && release\kshutdown-qt.exe`
  5. Right-click `kshutdown.nsi` and select Compile NSIS Script to build and test installer
- Experimental: To compile KShutdown under Wine/Linux run: `./Setup-wine.sh`

## Qt Build @ Haiku

Requires KShutdown 3.0 Beta 6 or later.

### Compilation

1. Download and install Qt for Haiku
2. Download and unpack KShutdown source
3. Open terminal with KShutdown source: `cd src`
4. Change the default C++ compiler to GCC 4: `setgcc gcc4`
5. Create Makefiles: `qmake`
6. Build "kshutdown-qt" binary: `make`

## Supported Functions/Platforms

Desktop Environment/Platform | Turn Off Computer1 | Restart Computer1 | Suspend | Hibernate | Lock Screen | Logout | Extras | Waiting for a selected application | Inactivity Monitor
Legend
TEST | Should work, still testing ;)
OK | Done (hover an item to display implementation details)
N/A | Function is not available on this platform/KShutdown version
TODO/FIXME | Work In Progress - to be implemented in a future...
CLI | Function available via Command Line (example: kshutdown --lock)
1 D-Bus commands should work with GDM, KDM, LightDM, and other Display Managers
KDE 4 (KDE Build) | OK | OK | OK | OK | OK | OK | OK | OK, no CLI | OK
Windows XP/Vista/7/8 | OK | OK | OK | OK | OK | OK | OK | OK, no CLI | OK
Xfce 4.8+ | OK | OK | OK | OK | OK | FIXME | TEST | OK, no CLI | TODO
LXDE | OK | OK | OK | OK | OK | OK | TEST | OK, no CLI | TODO
KDE 4 (Qt Build) | TEST | TEST | OK | OK | OK | TODO | TEST | OK, no CLI | OK
MATE | OK | OK | OK | TEST | OK | OK | OK | OK, no CLI | TODO
GNOME 3 | TEST | TEST | OK | OK | OK | OK | TEST | OK, no CLI | TODO
Unity | TEST | TEST | OK | OK | OK | OK | TEST | OK, no CLI | TODO
Enlightenment | TEST | TEST | OK | OK | OK | OK | TEST | OK, no CLI | TODO
Razor-qt | OK | OK | OK | OK | OK | OK | OK | OK, no CLI | TODO
Haiku | OK | OK | N/A | N/A | N/A | N/A | TEST | TODO | TODO
Openbox | TODO (?)
GNOME 2 | TEST (?) | TODO
Mac OS X | TODO (?)
KDE 3 | TODO (?); KShutDown 1.0.x exists but it's outdated and not supported...

## Compatibility with old KShutdown 1.0.x

Some configuration and command line options in KShutdown 2.x may be not fully compatible with the old KShutdown 1.0.x.