By default, Bugzilla does not search the list of RESOLVED bugs.
You can force it to do so by putting the upper-case word ALL in front of your search query, e.g.: ALL tdelibs
We recommend searching for bugs this way, as you may discover that your bug has already been resolved and fixed in a later release. View | Details | Raw Unified | Return to bug 1941
Collapse All | Expand All

(-)a/CMakeLists.txt (+1 lines)
Lines 88-93 OPTION( WITH_GAMIN "Enable FAM/GAMIN support" ${WITH_ALL_OPTIONS} ) Link Here
88
option( WITH_TDEHWLIB_DAEMONS "Enable daemons for TDE hwlib" ${WITH_ALL_OPTIONS} )
88
option( WITH_TDEHWLIB_DAEMONS "Enable daemons for TDE hwlib" ${WITH_ALL_OPTIONS} )
89
option( WITH_HAL "Enable HAL support" OFF )
89
option( WITH_HAL "Enable HAL support" OFF )
90
option( WITH_DEVKITPOWER "Enable DeviceKit Power support" OFF )
90
option( WITH_DEVKITPOWER "Enable DeviceKit Power support" OFF )
91
option( WITH_LOGINDPOWER "Enable Logind/Systemd Power support" OFF )
91
option( WITH_UPOWER "Enable uPower support" ${WITH_ALL_OPTIONS} )
92
option( WITH_UPOWER "Enable uPower support" ${WITH_ALL_OPTIONS} )
92
option( WITH_UDISKS "Enable uDisks support" ${WITH_ALL_OPTIONS} )
93
option( WITH_UDISKS "Enable uDisks support" ${WITH_ALL_OPTIONS} )
93
option( WITH_UDISKS2 "Enable uDisks2 support" ${WITH_ALL_OPTIONS} )
94
option( WITH_UDISKS2 "Enable uDisks2 support" ${WITH_ALL_OPTIONS} )
(-)a/tdecore/tdehw/CMakeLists.txt (+4 lines)
Lines 36-41 if( WITH_DEVKITPOWER ) Link Here
36
  add_definitions( -DWITH_DEVKITPOWER )
36
  add_definitions( -DWITH_DEVKITPOWER )
37
endif( )
37
endif( )
38
38
39
if( WITH_LOGINDPOWER )
40
  add_definitions( -DWITH_LOGINDPOWER )
41
endif( )
42
39
if( WITH_UPOWER )
43
if( WITH_UPOWER )
40
  add_definitions( -DWITH_UPOWER )
44
  add_definitions( -DWITH_UPOWER )
41
endif( )
45
endif( )
(-)a/tdecore/tdehw/tderootsystemdevice.cpp (-76 / +197 lines)
Lines 221-226 bool TDERootSystemDevice::canSuspend() { Link Here
221
		}
221
		}
222
	}
222
	}
223
223
224
#ifdef WITH_LOGINDPOWER
225
	{
226
		TQT_DBusConnection dbusConn = TQT_DBusConnection::addConnection(TQT_DBusConnection::SystemBus);
227
		if (dbusConn.isConnected()) {
228
			// can suspend?
229
			TQT_DBusMessage msg = TQT_DBusMessage::methodCall(
230
						"org.freedesktop.login1",
231
						"/org/freedesktop/login1",
232
						"org.freedesktop.login1.Manager",
233
						"CanSuspend");
234
			TQT_DBusMessage reply = dbusConn.sendWithReply(msg);
235
			if (reply.type() == TQT_DBusMessage::ReplyMessage && reply.count() == 1) {
236
				return (reply[0].toString() == "yes");
237
			}
238
		}
239
	}
240
#endif // WITH_LOGINDPOWER
241
224
#ifdef WITH_UPOWER
242
#ifdef WITH_UPOWER
225
	{
243
	{
226
		TQT_DBusConnection dbusConn = TQT_DBusConnection::addConnection(TQT_DBusConnection::SystemBus);
244
		TQT_DBusConnection dbusConn = TQT_DBusConnection::addConnection(TQT_DBusConnection::SystemBus);
Lines 322-327 bool TDERootSystemDevice::canHibernate() { Link Here
322
		}
340
		}
323
	}
341
	}
324
342
343
#ifdef WITH_LOGINDPOWER
344
	{
345
		TQT_DBusConnection dbusConn = TQT_DBusConnection::addConnection(TQT_DBusConnection::SystemBus);
346
		if (dbusConn.isConnected()) {
347
			// can hibernate?
348
			TQT_DBusMessage msg = TQT_DBusMessage::methodCall(
349
						"org.freedesktop.login1",
350
						"/org/freedesktop/login1",
351
						"org.freedesktop.login1.Manager",
352
						"CanHibernate");
353
			TQT_DBusMessage reply = dbusConn.sendWithReply(msg);
354
			if (reply.type() == TQT_DBusMessage::ReplyMessage && reply.count() == 1) {
355
				return (reply[0].toString() == "yes");
356
			}
357
		}
358
	}
359
#endif // WITH_LOGINDPOWER
360
325
#ifdef WITH_UPOWER
361
#ifdef WITH_UPOWER
326
	{
362
	{
327
		TQT_DBusConnection dbusConn = TQT_DBusConnection::addConnection(TQT_DBusConnection::SystemBus);
363
		TQT_DBusConnection dbusConn = TQT_DBusConnection::addConnection(TQT_DBusConnection::SystemBus);
Lines 410-450 bool TDERootSystemDevice::canPowerOff() { Link Here
410
	config->reparseConfiguration(); // config may have changed in the KControl module
446
	config->reparseConfiguration(); // config may have changed in the KControl module
411
447
412
	config->setGroup("General" );
448
	config->setGroup("General" );
413
	bool maysd = false;
449
	if (!config->readBoolEntry( "offerShutdown", true )) {
414
#ifdef WITH_CONSOLEKIT
450
		return FALSE;
415
	if (config->readBoolEntry( "offerShutdown", true )) {
451
	}
452
453
#ifdef WITH_LOGINDPOWER
454
	{
416
		TQT_DBusConnection dbusConn = TQT_DBusConnection::addConnection(TQT_DBusConnection::SystemBus);
455
		TQT_DBusConnection dbusConn = TQT_DBusConnection::addConnection(TQT_DBusConnection::SystemBus);
417
		if (dbusConn.isConnected()) {
456
		if (dbusConn.isConnected()) {
418
			TQT_DBusProxy consoleKitManager("org.freedesktop.ConsoleKit", "/org/freedesktop/ConsoleKit/Manager", "org.freedesktop.ConsoleKit.Manager", dbusConn);
457
			// can power off?
419
			if (consoleKitManager.canSend()) {
458
			TQT_DBusMessage msg = TQT_DBusMessage::methodCall(
420
				// can power off?
459
						"org.freedesktop.login1",
421
				TQValueList<TQT_DBusData> params;
460
						"/org/freedesktop/login1",
422
				TQT_DBusMessage reply = consoleKitManager.sendWithReply("CanStop", params);
461
						"org.freedesktop.login1.Manager",
423
				if (reply.type() == TQT_DBusMessage::ReplyMessage && reply.count() == 1) {
462
						"CanPowerOff");
424
					maysd = reply[0].toBool();
463
			TQT_DBusMessage reply = dbusConn.sendWithReply(msg);
425
				}
464
			if (reply.type() == TQT_DBusMessage::ReplyMessage && reply.count() == 1) {
426
				else {
465
				return (reply[0].toString() == "yes");
427
					maysd = false;
428
				}
429
			}
430
			else {
431
				maysd = false;
432
			}
466
			}
433
		}
467
		}
434
		else {
468
	}
435
			maysd = false;
469
#endif // WITH_LOGINDPOWER
470
471
#ifdef WITH_CONSOLEKIT
472
	{
473
		TQT_DBusConnection dbusConn = TQT_DBusConnection::addConnection(TQT_DBusConnection::SystemBus);
474
		if (dbusConn.isConnected()) {
475
			// can power off?
476
			TQT_DBusMessage msg = TQT_DBusMessage::methodCall(
477
						"org.freedesktop.ConsoleKit",
478
						"/org/freedesktop/ConsoleKit/Manager",
479
						"org.freedesktop.ConsoleKit.Manager",
480
						"CanStop");
481
			TQT_DBusMessage reply = dbusConn.sendWithReply(msg);
482
			if (reply.type() == TQT_DBusMessage::ReplyMessage && reply.count() == 1) {
483
				return reply[0].toBool();
484
			}
436
		}
485
		}
437
	}
486
	}
438
#else // WITH_CONSOLEKIT
487
#endif // WITH_CONSOLEKIT
488
439
	// FIXME
489
	// FIXME
440
	// Can we power down this system?
490
	// Can we power down this system?
441
	// This should probably be checked via DCOP and therefore interface with TDM
491
	// This should probably be checked via DCOP and therefore interface with TDM
442
	if (config->readBoolEntry( "offerShutdown", true )/* && DM().canShutdown()*/) {	// FIXME
492
	// if ( DM().canShutdown() ) {
443
		maysd = true;
493
	// 	return TRUE;
444
	}
494
	// }
445
#endif // WITH_CONSOLEKIT
495
	return TRUE;
446
447
	return maysd;
448
}
496
}
449
497
450
bool TDERootSystemDevice::canReboot() {
498
bool TDERootSystemDevice::canReboot() {
Lines 452-492 bool TDERootSystemDevice::canReboot() { Link Here
452
	config->reparseConfiguration(); // config may have changed in the KControl module
500
	config->reparseConfiguration(); // config may have changed in the KControl module
453
501
454
	config->setGroup("General" );
502
	config->setGroup("General" );
455
	bool mayrb = false;
503
	if (!config->readBoolEntry( "offerShutdown", true )) {
456
#ifdef WITH_CONSOLEKIT
504
		return FALSE;
457
	if (config->readBoolEntry( "offerShutdown", true )) {
505
	}
506
507
#ifdef WITH_LOGINDPOWER
508
	{
458
		TQT_DBusConnection dbusConn = TQT_DBusConnection::addConnection(TQT_DBusConnection::SystemBus);
509
		TQT_DBusConnection dbusConn = TQT_DBusConnection::addConnection(TQT_DBusConnection::SystemBus);
459
		if (dbusConn.isConnected()) {
510
		if (dbusConn.isConnected()) {
460
			TQT_DBusProxy consoleKitManager("org.freedesktop.ConsoleKit", "/org/freedesktop/ConsoleKit/Manager", "org.freedesktop.ConsoleKit.Manager", dbusConn);
511
			// can reboot?
461
			if (consoleKitManager.canSend()) {
512
			TQT_DBusMessage msg = TQT_DBusMessage::methodCall(
462
				// can reboot?
513
						"org.freedesktop.login1",
463
				TQValueList<TQT_DBusData> params;
514
						"/org/freedesktop/login1",
464
				TQT_DBusMessage reply = consoleKitManager.sendWithReply("CanRestart", params);
515
						"org.freedesktop.login1.Manager",
465
				if (reply.type() == TQT_DBusMessage::ReplyMessage && reply.count() == 1) {
516
						"CanReboot");
466
					mayrb = reply[0].toBool();
517
			TQT_DBusMessage reply = dbusConn.sendWithReply(msg);
467
				}
518
			if (reply.type() == TQT_DBusMessage::ReplyMessage && reply.count() == 1) {
468
				else {
519
				return (reply[0].toString() == "yes");
469
					mayrb = false;
470
				}
471
			}
472
			else {
473
				mayrb = false;
474
			}
520
			}
475
		}
521
		}
476
		else {
522
	}
477
			mayrb = false;
523
#endif // WITH_LOGINDPOWER
524
525
#ifdef WITH_CONSOLEKIT
526
	{
527
		TQT_DBusConnection dbusConn = TQT_DBusConnection::addConnection(TQT_DBusConnection::SystemBus);
528
		if (dbusConn.isConnected()) {
529
			// can reboot?
530
			TQT_DBusMessage msg = TQT_DBusMessage::methodCall(
531
						"org.freedesktop.ConsoleKit",
532
						"/org/freedesktop/ConsoleKit/Manager",
533
						"org.freedesktop.ConsoleKit.Manager",
534
						"CanRestart");
535
			TQT_DBusMessage reply = dbusConn.sendWithReply(msg);
536
			if (reply.type() == TQT_DBusMessage::ReplyMessage && reply.count() == 1) {
537
				return reply[0].toBool();
538
			}
478
		}
539
		}
479
	}
540
	}
480
#else // WITH_CONSOLEKIT
541
#endif // WITH_CONSOLEKIT
542
481
	// FIXME
543
	// FIXME
482
	// Can we power down this system?
544
	// Can we power down this system?
483
	// This should probably be checked via DCOP and therefore interface with TDM
545
	// This should probably be checked via DCOP and therefore interface with TDM
484
	if (config->readBoolEntry( "offerShutdown", true )/* && DM().canShutdown()*/) {	// FIXME
546
	// if ( DM().canShutdown() ) {
485
		mayrb = true;
547
	// 	return TRUE;
486
	}
548
	// }
487
#endif // WITH_CONSOLEKIT
549
	return TRUE;
488
489
	return mayrb;
490
}
550
}
491
551
492
void TDERootSystemDevice::setHibernationMethod(TDESystemHibernationMethod::TDESystemHibernationMethod hm) {
552
void TDERootSystemDevice::setHibernationMethod(TDESystemHibernationMethod::TDESystemHibernationMethod hm) {
Lines 575-580 bool TDERootSystemDevice::setPowerState(TDESystemPowerState::TDESystemPowerState Link Here
575
			return true;
635
			return true;
576
		}
636
		}
577
637
638
#ifdef WITH_LOGINDPOWER
639
		{
640
			TQT_DBusConnection dbusConn;
641
			dbusConn = TQT_DBusConnection::addConnection(TQT_DBusConnection::SystemBus);
642
			if ( dbusConn.isConnected() ) {
643
				if (ps == TDESystemPowerState::Suspend) {
644
					TQT_DBusMessage msg = TQT_DBusMessage::methodCall(
645
								"org.freedesktop.login1",
646
								"/org/freedesktop/login1",
647
								"org.freedesktop.login1.Manager",
648
								"Suspend");
649
					TQT_DBusMessage reply = dbusConn.sendWithReply(msg);
650
					if (reply.type() == TQT_DBusMessage::ReplyMessage) {
651
						return true;
652
					}
653
				}
654
				else if (ps == TDESystemPowerState::Hibernate) {
655
					TQT_DBusMessage msg = TQT_DBusMessage::methodCall(
656
								"org.freedesktop.login1",
657
								"/org/freedesktop/login1",
658
								"org.freedesktop.login1.Manager",
659
								"Hibernate");
660
					TQT_DBusMessage reply = dbusConn.sendWithReply(msg);
661
					if (reply.type() == TQT_DBusMessage::ReplyMessage) {
662
						return true;
663
					}
664
				}
665
			}
666
		}
667
#endif // WITH_LOGINDPOWER
668
578
#ifdef WITH_UPOWER
669
#ifdef WITH_UPOWER
579
		{
670
		{
580
			TQT_DBusConnection dbusConn;
671
			TQT_DBusConnection dbusConn;
Lines 726-736 bool TDERootSystemDevice::setPowerState(TDESystemPowerState::TDESystemPowerState Link Here
726
		return false;
817
		return false;
727
	}
818
	}
728
	else if (ps == TDESystemPowerState::PowerOff) {
819
	else if (ps == TDESystemPowerState::PowerOff) {
729
#ifdef WITH_CONSOLEKIT
730
		TDEConfig *config = TDEGlobal::config();
820
		TDEConfig *config = TDEGlobal::config();
731
		config->reparseConfiguration(); // config may have changed in the KControl module
821
		config->reparseConfiguration(); // config may have changed in the KControl module
732
		config->setGroup("General" );
822
		config->setGroup("General" );
733
		if (config->readBoolEntry( "offerShutdown", true )) {
823
		if (!config->readBoolEntry( "offerShutdown", true )) {
824
			return false;
825
		}
826
#ifdef WITH_LOGINDPOWER
827
		{
828
			TQT_DBusConnection dbusConn;
829
			dbusConn = TQT_DBusConnection::addConnection(TQT_DBusConnection::SystemBus);
830
			if ( dbusConn.isConnected() ) {
831
				TQT_DBusMessage msg = TQT_DBusMessage::methodCall(
832
							"org.trinitydesktop.login1",
833
							"/org/freedesktop/login1",
834
							"org.freedesktop.login1.Manager",
835
							"PowerOff");
836
				TQT_DBusMessage reply = dbusConn.sendWithReply(msg);
837
				if (reply.type() == TQT_DBusMessage::ReplyMessage) {
838
					return true;
839
				}
840
			}
841
		}
842
#endif // WITH_LOGINDPOWER
843
#ifdef WITH_CONSOLEKIT
844
		{
734
			TQT_DBusConnection dbusConn;
845
			TQT_DBusConnection dbusConn;
735
			dbusConn = TQT_DBusConnection::addConnection(TQT_DBusConnection::SystemBus);
846
			dbusConn = TQT_DBusConnection::addConnection(TQT_DBusConnection::SystemBus);
736
			if ( dbusConn.isConnected() ) {
847
			if ( dbusConn.isConnected() ) {
Lines 739-755 bool TDERootSystemDevice::setPowerState(TDESystemPowerState::TDESystemPowerState Link Here
739
							"/org/freedesktop/ConsoleKit/Manager",
850
							"/org/freedesktop/ConsoleKit/Manager",
740
							"org.freedesktop.ConsoleKit.Manager",
851
							"org.freedesktop.ConsoleKit.Manager",
741
							"Stop");
852
							"Stop");
742
				dbusConn.sendWithReply(msg);
853
				TQT_DBusMessage reply = dbusConn.sendWithReply(msg);
743
				return true;
854
				if (reply.type() == TQT_DBusMessage::ReplyMessage) {
744
			}
855
					return true;
745
			else {
856
				}
746
				return false;
747
			}
857
			}
748
		}
858
		}
749
		else {
859
#endif // WITH_CONSOLEKIT
750
			return false;
751
		}
752
#else // WITH_CONSOLEKIT
753
		// Power down the system using a DCOP command
860
		// Power down the system using a DCOP command
754
		// Values are explained at http://lists.kde.org/?l=kde-linux&m=115770988603387
861
		// Values are explained at http://lists.kde.org/?l=kde-linux&m=115770988603387
755
		TQByteArray data;
862
		TQByteArray data;
Lines 759-772 bool TDERootSystemDevice::setPowerState(TDESystemPowerState::TDESystemPowerState Link Here
759
			return true;
866
			return true;
760
		}
867
		}
761
		return false;
868
		return false;
762
#endif // WITH_CONSOLEKIT
763
	}
869
	}
764
	else if (ps == TDESystemPowerState::Reboot) {
870
	else if (ps == TDESystemPowerState::Reboot) {
765
#ifdef WITH_CONSOLEKIT
766
		TDEConfig *config = TDEGlobal::config();
871
		TDEConfig *config = TDEGlobal::config();
767
		config->reparseConfiguration(); // config may have changed in the KControl module
872
		config->reparseConfiguration(); // config may have changed in the KControl module
768
		config->setGroup("General" );
873
		config->setGroup("General" );
769
		if (config->readBoolEntry( "offerShutdown", true )) {
874
		if (!config->readBoolEntry( "offerShutdown", true )) {
875
			return false;
876
		}
877
#ifdef WITH_LOGINDPOWER
878
		{
879
			TQT_DBusConnection dbusConn;
880
			dbusConn = TQT_DBusConnection::addConnection(TQT_DBusConnection::SystemBus);
881
			if ( dbusConn.isConnected() ) {
882
				TQT_DBusMessage msg = TQT_DBusMessage::methodCall(
883
							"org.trinitydesktop.login1",
884
							"/org/freedesktop/login1",
885
							"org.freedesktop.login1.Manager",
886
							"Reboot");
887
				TQT_DBusMessage reply = dbusConn.sendWithReply(msg);
888
				if (reply.type() == TQT_DBusMessage::ReplyMessage) {
889
					return true;
890
				}
891
			}
892
		}
893
#endif // WITH_LOGINDPOWER
894
#ifdef WITH_CONSOLEKIT
895
		{
770
			TQT_DBusConnection dbusConn;
896
			TQT_DBusConnection dbusConn;
771
			dbusConn = TQT_DBusConnection::addConnection(TQT_DBusConnection::SystemBus);
897
			dbusConn = TQT_DBusConnection::addConnection(TQT_DBusConnection::SystemBus);
772
			if ( dbusConn.isConnected() ) {
898
			if ( dbusConn.isConnected() ) {
Lines 775-791 bool TDERootSystemDevice::setPowerState(TDESystemPowerState::TDESystemPowerState Link Here
775
							"/org/freedesktop/ConsoleKit/Manager",
901
							"/org/freedesktop/ConsoleKit/Manager",
776
							"org.freedesktop.ConsoleKit.Manager",
902
							"org.freedesktop.ConsoleKit.Manager",
777
							"Restart");
903
							"Restart");
778
				dbusConn.sendWithReply(msg);
904
				TQT_DBusMessage reply = dbusConn.sendWithReply(msg);
779
				return true;
905
				if (reply.type() == TQT_DBusMessage::ReplyMessage) {
780
			}
906
					return true;
781
			else {
907
				}
782
				return false;
783
			}
908
			}
784
		}
909
		}
785
		else {
910
#endif // WITH_CONSOLEKIT
786
			return false;
787
		}
788
#else // WITH_CONSOLEKIT
789
		// Power down the system using a DCOP command
911
		// Power down the system using a DCOP command
790
		// Values are explained at http://lists.kde.org/?l=kde-linux&m=115770988603387
912
		// Values are explained at http://lists.kde.org/?l=kde-linux&m=115770988603387
791
		TQByteArray data;
913
		TQByteArray data;
Lines 795-801 bool TDERootSystemDevice::setPowerState(TDESystemPowerState::TDESystemPowerState Link Here
795
			return true;
917
			return true;
796
		}
918
		}
797
		return false;
919
		return false;
798
#endif // WITH_CONSOLEKIT
799
	}
920
	}
800
	else if (ps == TDESystemPowerState::Active) {
921
	else if (ps == TDESystemPowerState::Active) {
801
		// Ummm...we're already active...
922
		// Ummm...we're already active...

Return to bug 1941