Merge branch 'master' into HEAD

Conflicts:
	tdecore/CMakeLists.txt
	tdecore/tdehardwaredevices.h
	tdecore/tdehw/tdehardwaredevices.cpp
pull/16/head
Alexander Golubev 11 years ago
commit b7ff6c3330

@ -17,7 +17,7 @@ cmake_minimum_required( VERSION 2.8 )
project( tdelibs ) project( tdelibs )
set( PACKAGE tdelibs ) set( PACKAGE tdelibs )
set( VERSION "3.5.13" ) set( VERSION R14.0.0 )
##### include essential cmake modules ########### ##### include essential cmake modules ###########
@ -591,6 +591,8 @@ endif( XRANDR_FOUND )
pkg_search_module( XRENDER xrender ) pkg_search_module( XRENDER xrender )
if( XRENDER_FOUND ) if( XRENDER_FOUND )
set( HAVE_XRENDER 1 ) set( HAVE_XRENDER 1 )
else( XRENDER_FOUND)
message(FATAL_ERROR "\nxrender support is required, but not found on your system" )
endif( XRENDER_FOUND ) endif( XRENDER_FOUND )
##### check for xcomposite ######################### ##### check for xcomposite #########################

@ -35,7 +35,7 @@ install( FILES kdedmodule.h DESTINATION ${INCLUDE_INSTALL_DIR} )
##### other data ################################ ##### other data ################################
install( FILES kdedmodule.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR} ) install( FILES kdedmodule.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR} )
install( FILES applications.menu applications.menu-no-kde DESTINATION ${XDG_MENU_INSTALL_DIR} ) install( FILES tde-applications.menu tde-applications.menu-no-kde DESTINATION ${XDG_MENU_INSTALL_DIR} )
install( FILES kded.upd DESTINATION ${KCONF_UPDATE_INSTALL_DIR} ) install( FILES kded.upd DESTINATION ${KCONF_UPDATE_INSTALL_DIR} )

@ -379,7 +379,7 @@ bool KBuildSycoca::build()
connect(g_vfolder, TQT_SIGNAL(newService(const TQString &, KService **)), connect(g_vfolder, TQT_SIGNAL(newService(const TQString &, KService **)),
this, TQT_SLOT(slotCreateEntry(const TQString &, KService **))); this, TQT_SLOT(slotCreateEntry(const TQString &, KService **)));
VFolderMenu::SubMenu *kdeMenu = g_vfolder->parseMenu("applications.menu", true); VFolderMenu::SubMenu *kdeMenu = g_vfolder->parseMenu("tde-applications.menu", true);
KServiceGroup *entry = g_bsgf->addNew("/", kdeMenu->directoryFile, 0, false); KServiceGroup *entry = g_bsgf->addNew("/", kdeMenu->directoryFile, 0, false);
entry->setLayoutInfo(kdeMenu->layoutList); entry->setLayoutInfo(kdeMenu->layoutList);

@ -28,6 +28,7 @@ include_directories(
link_directories( link_directories(
${TQT_LIBRARY_DIRS} ${TQT_LIBRARY_DIRS}
${LIBART_LIBRARY_DIRS}
) )

@ -40,6 +40,7 @@ link_directories(
${TQT_LIBRARY_DIRS} ${TQT_LIBRARY_DIRS}
${LIBIDN_LIBRARY_DIRS} ${LIBIDN_LIBRARY_DIRS}
${GAMIN_LIBDIR} ${GAMIN_LIBDIR}
${LIBART_LIBRARY_DIRS}
) )
##### headers ################################### ##### headers ###################################

@ -35,7 +35,14 @@
#undef QT_NO_TRANSLATION #undef QT_NO_TRANSLATION
#undef TQT_NO_TRANSLATION #undef TQT_NO_TRANSLATION
#include <tqtranslator.h> #include <tqtranslator.h>
// FIXME
// FOR BINARY COMPATIBILITY ONLY
// REMOVE WHEN PRACTICAL!
#define TDEAPPLICATION_BINARY_COMPAT_HACK 1
#include "tdeapplication.h" #include "tdeapplication.h"
#undef TDEAPPLICATION_BINARY_COMPAT_HACK
#define QT_NO_TRANSLATION #define QT_NO_TRANSLATION
#define TQT_NO_TRANSLATION #define TQT_NO_TRANSLATION
#include <tqdir.h> #include <tqdir.h>
@ -168,6 +175,14 @@ typedef void* IceIOErrorHandler;
#include <tqimage.h> #include <tqimage.h>
#endif #endif
#if defined Q_WS_X11
#include <sys/ioctl.h>
#include <linux/vt.h>
extern "C" {
extern int getfd(const char *fnam);
}
#endif
#include "kappdcopiface.h" #include "kappdcopiface.h"
// exported for tdm kfrontend // exported for tdm kfrontend
@ -235,6 +250,67 @@ void TDEApplication_init_windows(bool GUIenabled);
class QAssistantClient; class QAssistantClient;
#endif #endif
#ifdef Q_WS_X11
// --------------------------------------------------------------------------------------
// Get the VT number X is running on
// (code taken from GDM, daemon/getvt.c, GPLv2+)
// --------------------------------------------------------------------------------------
int get_x_vtnum(Display *dpy)
{
Atom prop;
Atom actualtype;
int actualformat;
unsigned long nitems;
unsigned long bytes_after;
unsigned char *buf;
int num;
prop = XInternAtom (dpy, "XFree86_VT", False);
if (prop == None)
return -1;
if (XGetWindowProperty (dpy, DefaultRootWindow (dpy), prop, 0, 1,
False, AnyPropertyType, &actualtype, &actualformat,
&nitems, &bytes_after, &buf)) {
return -1;
}
if (nitems != 1) {
XFree (buf);
return -1;
}
switch (actualtype) {
case XA_CARDINAL:
case XA_INTEGER:
case XA_WINDOW:
switch (actualformat) {
case 8:
num = (*(uint8_t *)(void *)buf);
break;
case 16:
num = (*(uint16_t *)(void *)buf);
break;
case 32:
num = (*(uint32_t *)(void *)buf);
break;
default:
XFree (buf);
return -1;
}
break;
default:
XFree (buf);
return -1;
}
XFree (buf);
return num;
}
// --------------------------------------------------------------------------------------
#endif // Q_WS_X11
/* /*
Private data to make keeping binary compatibility easier Private data to make keeping binary compatibility easier
*/ */
@ -621,6 +697,34 @@ static SmcConn tmpSmcConnection = 0;
#endif #endif
static TQTime* smModificationTime = 0; static TQTime* smModificationTime = 0;
TDEApplication::TDEApplication( int& argc, char** argv, const TQCString& rAppName,
bool allowStyles, bool GUIenabled, bool SMenabled ) :
TQApplication( argc, argv, GUIenabled, SMenabled ), TDEInstance(rAppName),
#ifdef Q_WS_X11
display(0L),
argb_visual(false),
#endif
d (new TDEApplicationPrivate())
{
aIconPixmap.pm.icon = 0L;
aIconPixmap.pm.miniIcon = 0L;
read_app_startup_id();
if (!GUIenabled)
allowStyles = false;
useStyles = allowStyles;
Q_ASSERT (!rAppName.isEmpty());
setName(rAppName);
installSigpipeHandler();
TDECmdLineArgs::initIgnore(argc, argv, rAppName.data());
parseCommandLine( );
init(GUIenabled);
d->m_KAppDCOPInterface = new KAppDCOPInterface(this);
}
// FIXME
// FOR BINARY COMPATIBILITY ONLY
// REMOVE WHEN PRACTICAL!
TDEApplication::TDEApplication( int& argc, char** argv, const TQCString& rAppName, TDEApplication::TDEApplication( int& argc, char** argv, const TQCString& rAppName,
bool allowStyles, bool GUIenabled ) : bool allowStyles, bool GUIenabled ) :
TQApplication( argc, argv, GUIenabled ), TDEInstance(rAppName), TQApplication( argc, argv, GUIenabled ), TDEInstance(rAppName),
@ -646,6 +750,33 @@ TDEApplication::TDEApplication( int& argc, char** argv, const TQCString& rAppNam
d->m_KAppDCOPInterface = new KAppDCOPInterface(this); d->m_KAppDCOPInterface = new KAppDCOPInterface(this);
} }
TDEApplication::TDEApplication( bool allowStyles, bool GUIenabled, bool SMenabled ) :
// TQApplication( *TDECmdLineArgs::tqt_argc(), *TDECmdLineArgs::tqt_argv(), TRUE ), // Qt4 requires that there always be a GUI
TQApplication( *TDECmdLineArgs::tqt_argc(), *TDECmdLineArgs::tqt_argv(), GUIenabled, SMenabled ), // We need to be able to run command line apps
TDEInstance( TDECmdLineArgs::about),
#ifdef Q_WS_X11
display(0L),
argb_visual(false),
#endif
d (new TDEApplicationPrivate)
{
aIconPixmap.pm.icon = 0L;
aIconPixmap.pm.miniIcon = 0L;
read_app_startup_id();
if (!GUIenabled)
allowStyles = false;
useStyles = allowStyles;
setName( instanceName() );
installSigpipeHandler();
parseCommandLine( );
init(GUIenabled);
d->m_KAppDCOPInterface = new KAppDCOPInterface(this);
}
// FIXME
// FOR BINARY COMPATIBILITY ONLY
// REMOVE WHEN PRACTICAL!
TDEApplication::TDEApplication( bool allowStyles, bool GUIenabled ) : TDEApplication::TDEApplication( bool allowStyles, bool GUIenabled ) :
// TQApplication( *TDECmdLineArgs::tqt_argc(), *TDECmdLineArgs::tqt_argv(), TRUE ), // Qt4 requires that there always be a GUI // TQApplication( *TDECmdLineArgs::tqt_argc(), *TDECmdLineArgs::tqt_argv(), TRUE ), // Qt4 requires that there always be a GUI
TQApplication( *TDECmdLineArgs::tqt_argc(), *TDECmdLineArgs::tqt_argv(), GUIenabled ), // We need to be able to run command line apps TQApplication( *TDECmdLineArgs::tqt_argc(), *TDECmdLineArgs::tqt_argv(), GUIenabled ), // We need to be able to run command line apps
@ -3597,6 +3728,18 @@ TQ_ButtonState TDEApplication::keyboardMouseState()
return static_cast< ButtonState >( ret ); return static_cast< ButtonState >( ret );
} }
#if defined Q_WS_X11
int TDEApplication::currentX11VT()
{
return get_x_vtnum(TQPaintDevice::x11AppDisplay());
}
#else // Q_WS_X11
int TDEApplication::currentX11VT()
{
return -1;
}
#endif // Q_WS_X11
void TDEApplication::installSigpipeHandler() void TDEApplication::installSigpipeHandler()
{ {
#ifdef Q_OS_UNIX #ifdef Q_OS_UNIX

@ -128,7 +128,14 @@ public:
* @param GUIenabled Set to false to disable all GUI stuff. This implies * @param GUIenabled Set to false to disable all GUI stuff. This implies
* no styles either. * no styles either.
*/ */
TDEApplication( bool allowStyles=true, bool GUIenabled=true, bool SMenabled=true);
#ifdef TDEAPPLICATION_BINARY_COMPAT_HACK
// FIXME
// FOR BINARY COMPATIBILITY ONLY
// REMOVE WHEN PRACTICAL!
TDEApplication( bool allowStyles=true, bool GUIenabled=true); TDEApplication( bool allowStyles=true, bool GUIenabled=true);
#endif // TDEAPPLICATION_BINARY_COMPAT_HACK
#ifdef Q_WS_X11 #ifdef Q_WS_X11
/** /**
@ -258,7 +265,15 @@ public:
// REMOVE FOR KDE 4.0 - using it only gives crashing applications because // REMOVE FOR KDE 4.0 - using it only gives crashing applications because
// TDECmdLineArgs::init isn't called // TDECmdLineArgs::init isn't called
TDEApplication(int& argc, char** argv, TDEApplication(int& argc, char** argv,
const TQCString& rAppName, bool allowStyles=true, bool GUIenabled=true) KDE_DEPRECATED; const TQCString& rAppName, bool allowStyles=true, bool GUIenabled=true, bool SMenabled=true) KDE_DEPRECATED;
#ifdef TDEAPPLICATION_BINARY_COMPAT_HACK
// FIXME
// FOR BINARY COMPATIBILITY ONLY
// REMOVE WHEN PRACTICAL!
TDEApplication(int& argc, char** argv,
const TQCString& rAppName, bool allowStyles, bool GUIenabled) KDE_DEPRECATED;
#endif // TDEAPPLICATION_BINARY_COMPAT_HACK
/** /**
* Add Qt and KDE command line options to TDECmdLineArgs. * Add Qt and KDE command line options to TDECmdLineArgs.
@ -1212,6 +1227,13 @@ public:
*/ */
static uint mouseState() KDE_DEPRECATED; static uint mouseState() KDE_DEPRECATED;
/**
* Returns the VT that the current X server is running on, or -1 if this information is unavailable.
*
* @since 14.0.0
*/
static int currentX11VT();
public slots: public slots:
/** /**

@ -65,6 +65,7 @@
#include "tdeeventdevice.h" #include "tdeeventdevice.h"
#include "tdeinputdevice.h" #include "tdeinputdevice.h"
// Compile-time configuration
#include "config.h" #include "config.h"
// BEGIN BLOCK // BEGIN BLOCK
@ -2558,6 +2559,15 @@ void TDEHardwareDevices::updateExistingDeviceInformation(TDEGenericDevice* exist
if (nodename == "alarm") { if (nodename == "alarm") {
bdevice->internalSetAlarmEnergy(line.toDouble()/1000000.0); bdevice->internalSetAlarmEnergy(line.toDouble()/1000000.0);
} }
if (nodename == "charge_full") {
bdevice->internalSetMaximumEnergy(line.toDouble()/1000000.0);
}
if (nodename == "charge_full_design") {
bdevice->internalSetMaximumDesignEnergy(line.toDouble()/1000000.0);
}
if (nodename == "charge_now") {
bdevice->internalSetEnergy(line.toDouble()/1000000.0);
}
if (nodename == "energy_full") { if (nodename == "energy_full") {
bdevice->internalSetMaximumEnergy(line.toDouble()/1000000.0); bdevice->internalSetMaximumEnergy(line.toDouble()/1000000.0);
} }

@ -592,7 +592,7 @@ TQString TDEStorageDevice::mountPath() {
return TQString::null; return TQString::null;
} }
TQString TDEStorageDevice::mountDevice(TQString mediaName, TQString mountOptions, TQString* errRet, int* retcode) { TQString TDEStorageDevice::mountDevice(TQString mediaName, TDEStorageMountOptions mountOptions, TQString* errRet, int* retcode) {
int internal_retcode; int internal_retcode;
if (!retcode) { if (!retcode) {
retcode = &internal_retcode; retcode = &internal_retcode;
@ -608,12 +608,37 @@ TQString TDEStorageDevice::mountDevice(TQString mediaName, TQString mountOptions
KTempFile passwordFile(TQString::null, "tmp", 0600); KTempFile passwordFile(TQString::null, "tmp", 0600);
passwordFile.setAutoDelete(true); passwordFile.setAutoDelete(true);
TQString optionString;
if (mountOptions["ro"] == "true") {
optionString.append(" -r");
}
if (mountOptions["atime"] != "true") {
optionString.append(" -A");
}
if (mountOptions["utf8"] == "true") {
optionString.append(" -c utf8");
}
if (mountOptions["sync"] == "true") {
optionString.append(" -s");
}
if (mountOptions.contains("filesystem")) {
optionString.append(TQString(" -t %1").arg(mountOptions["filesystem"]));
}
if (mountOptions.contains("locale")) {
optionString.append(TQString(" -c %1").arg(mountOptions["locale"]));
}
TQString passFileName = passwordFile.name(); TQString passFileName = passwordFile.name();
TQString devNode = deviceNode(); TQString devNode = deviceNode();
passFileName.replace("'", "'\\''"); passFileName.replace("'", "'\\''");
devNode.replace("'", "'\\''"); devNode.replace("'", "'\\''");
mediaName.replace("'", "'\\''"); mediaName.replace("'", "'\\''");
TQString command = TQString("pmount -p '%1' %2 '%3' '%4' 2>&1").arg(passFileName).arg(mountOptions).arg(devNode).arg(mediaName); TQString command = TQString("pmount -p '%1' %2 '%3' '%4' 2>&1").arg(passFileName).arg(optionString).arg(devNode).arg(mediaName);
FILE *exepipe = popen(command.ascii(), "r"); FILE *exepipe = popen(command.ascii(), "r");
if (exepipe) { if (exepipe) {
@ -634,7 +659,7 @@ TQString TDEStorageDevice::mountDevice(TQString mediaName, TQString mountOptions
return ret; return ret;
} }
TQString TDEStorageDevice::mountEncryptedDevice(TQString passphrase, TQString mediaName, TQString mountOptions, TQString* errRet, int* retcode) { TQString TDEStorageDevice::mountEncryptedDevice(TQString passphrase, TQString mediaName, TDEStorageMountOptions mountOptions, TQString* errRet, int* retcode) {
int internal_retcode; int internal_retcode;
if (!retcode) { if (!retcode) {
retcode = &internal_retcode; retcode = &internal_retcode;
@ -657,12 +682,37 @@ TQString TDEStorageDevice::mountEncryptedDevice(TQString passphrase, TQString me
pwFile->writeBlock(passphrase.ascii(), passphrase.length()); pwFile->writeBlock(passphrase.ascii(), passphrase.length());
pwFile->flush(); pwFile->flush();
TQString optionString;
if (mountOptions["ro"] == "true") {
optionString.append(" -r");
}
if (mountOptions["atime"] != "true") {
optionString.append(" -A");
}
if (mountOptions["utf8"] == "true") {
optionString.append(" -c utf8");
}
if (mountOptions["sync"] == "true") {
optionString.append(" -s");
}
if (mountOptions.contains("filesystem")) {
optionString.append(TQString(" -t %1").arg(mountOptions["filesystem"]));
}
if (mountOptions.contains("locale")) {
optionString.append(TQString(" -c %1").arg(mountOptions["locale"]));
}
TQString passFileName = passwordFile.name(); TQString passFileName = passwordFile.name();
TQString devNode = deviceNode(); TQString devNode = deviceNode();
passFileName.replace("'", "'\\''"); passFileName.replace("'", "'\\''");
devNode.replace("'", "'\\''"); devNode.replace("'", "'\\''");
mediaName.replace("'", "'\\''"); mediaName.replace("'", "'\\''");
TQString command = TQString("pmount -p '%1' %2 '%3' '%4' 2>&1").arg(passFileName).arg(mountOptions).arg(devNode).arg(mediaName); TQString command = TQString("pmount -p '%1' %2 '%3' '%4' 2>&1").arg(passFileName).arg(optionString).arg(devNode).arg(mediaName);
FILE *exepipe = popen(command.ascii(), "r"); FILE *exepipe = popen(command.ascii(), "r");
if (exepipe) { if (exepipe) {

@ -105,6 +105,8 @@ inline TDEDiskDeviceStatus operator~(TDEDiskDeviceStatus a)
} }
}; };
typedef TQMap<TQString,TQString> TDEStorageMountOptions;
class TDECORE_EXPORT TDEStorageDevice : public TDEGenericDevice class TDECORE_EXPORT TDEStorageDevice : public TDEGenericDevice
{ {
public: public:
@ -174,7 +176,7 @@ class TDECORE_EXPORT TDEStorageDevice : public TDEGenericDevice
* *
* @return a TQString with the mount path, if successful * @return a TQString with the mount path, if successful
*/ */
TQString mountDevice(TQString mediaName=TQString::null, TQString mountOptions=TQString::null, TQString* errRet=0, int* retcode=0); TQString mountDevice(TQString mediaName=TQString::null, TDEStorageMountOptions mountOptions=TDEStorageMountOptions(), TQString* errRet=0, int* retcode=0);
/** /**
* Mounts the encrypted device if the correct passphrase is given * Mounts the encrypted device if the correct passphrase is given
@ -187,7 +189,7 @@ class TDECORE_EXPORT TDEStorageDevice : public TDEGenericDevice
* *
* @return a TQString with the mount path, if successful * @return a TQString with the mount path, if successful
*/ */
TQString mountEncryptedDevice(TQString passphrase, TQString mediaName=TQString::null, TQString mountOptions=TQString::null, TQString* errRet=0, int* retcode=0); TQString mountEncryptedDevice(TQString passphrase, TQString mediaName=TQString::null, TDEStorageMountOptions mountOptions=TDEStorageMountOptions(), TQString* errRet=0, int* retcode=0);
/** /**
* Unmounts the device * Unmounts the device

@ -42,7 +42,7 @@ extern "C"
int kdemain(int argc, char **argv) int kdemain(int argc, char **argv)
{ {
TDEApplication app(argc, argv, "tdeio_metainfo", false, true); TDEApplication app(argc, argv, "tdeio_metainfo", false, true, false);
if (argc != 4) if (argc != 4)
{ {

Loading…
Cancel
Save