summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-07-16 02:08:39 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-07-16 02:08:39 -0500
commitbae793079f00cde6d857b55ef9c2d98ec6e091e6 (patch)
tree0e1f161f9095487ee0cb930d3d208c1267515006
parentefda5c30fc737a49920900ace57a6bfffb9be27b (diff)
downloadtdelibs-bae793079f00cde6d857b55ef9c2d98ec6e091e6.tar.gz
tdelibs-bae793079f00cde6d857b55ef9c2d98ec6e091e6.zip
Fix network-manager backend crash on certain systems when network-manager is not available
Add ability to show buttons in KSMModalDialog
-rw-r--r--tdecore/networkbackends/network-manager/network-manager.cpp29
-rw-r--r--tdeui/kdialog.cpp21
-rw-r--r--tdeui/kdialog.h8
3 files changed, 46 insertions, 12 deletions
diff --git a/tdecore/networkbackends/network-manager/network-manager.cpp b/tdecore/networkbackends/network-manager/network-manager.cpp
index ac07b8a1a..a7295beac 100644
--- a/tdecore/networkbackends/network-manager/network-manager.cpp
+++ b/tdecore/networkbackends/network-manager/network-manager.cpp
@@ -1689,19 +1689,26 @@ TDENetworkDeviceType::TDENetworkDeviceType TDENetworkConnectionManager_BackendNM
return TDENetworkDeviceType::BackendOnly;
}
else {
- // Query NM for the device type
- TQT_DBusError error;
- d->m_dbusDeviceString = deviceInterfaceString(m_macAddress);
- DBus::DeviceProxy genericDevice(NM_DBUS_SERVICE, d->m_dbusDeviceString);
- genericDevice.setConnection(TQT_DBusConnection::systemBus());
- TDENetworkDeviceType::TDENetworkDeviceType ret = nmDeviceTypeToTDEDeviceType(genericDevice.getDeviceType(error));
- if (error.isValid()) {
- // Error!
- PRINT_ERROR((error.name() + ": " + error.message()))
- return TDENetworkDeviceType::Other;
+ if (d->m_dbusDeviceString != "") {
+ // Query NM for the device type
+ TQT_DBusError error;
+ d->m_dbusDeviceString = deviceInterfaceString(m_macAddress);
+ DBus::DeviceProxy genericDevice(NM_DBUS_SERVICE, d->m_dbusDeviceString);
+ genericDevice.setConnection(TQT_DBusConnection::systemBus());
+ TDENetworkDeviceType::TDENetworkDeviceType ret = nmDeviceTypeToTDEDeviceType(genericDevice.getDeviceType(error));
+ if (error.isValid()) {
+ // Error!
+ PRINT_ERROR((error.name() + ": " + error.message()))
+ return TDENetworkDeviceType::Other;
+ }
+ else {
+ return ret;
+ }
}
else {
- return ret;
+ // Error!
+ PRINT_ERROR(TQString("Invalid DBUS device string '%1'").arg(d->m_dbusDeviceString))
+ return TDENetworkDeviceType::Other;
}
}
}
diff --git a/tdeui/kdialog.cpp b/tdeui/kdialog.cpp
index 86f7f7476..c20bac5a0 100644
--- a/tdeui/kdialog.cpp
+++ b/tdeui/kdialog.cpp
@@ -38,6 +38,7 @@
#include <tqlabel.h>
#include <tqstyle.h>
#include <tqimage.h>
+#include <tqpushbutton.h>
#include "config.h"
#ifdef Q_WS_X11
@@ -419,13 +420,31 @@ KSMModalDialog::KSMModalDialog(TQWidget* parent)
fnt.setBold( false );
fnt.setPointSize( fnt.pointSize() * 1 );
m_statusLabel->setFont( fnt );
- gbox->addMultiCellWidget( m_statusLabel, 2, 2, 0, 0, AlignLeft | AlignVCenter );
+ gbox->addMultiCellWidget( m_statusLabel, 2, 2, 0, 2, AlignLeft | AlignVCenter );
KSMModalDialogHeader *theader = new KSMModalDialogHeader(this);
centerbox->addWidget( theader, AlignCenter );
gbox->addLayout(centerbox, 0, 0);
+ TQFrame* frame2 = new TQFrame( this );
+ frame2->setFrameStyle( TQFrame::NoFrame );
+ frame2->setLineWidth( style().pixelMetric( TQStyle::PM_DefaultFrameWidth, frame ) );
+ m_buttonbox = new TQHBoxLayout( frame2, 0, KDialog::spacingHint() );
+
+ m_button1 = new TQPushButton( frame2 );
+ m_button2 = new TQPushButton( frame2 );
+ m_button3 = new TQPushButton( frame2 );
+ m_buttonbox->addWidget( m_button1 );
+ m_buttonbox->addWidget( m_button2 );
+ m_buttonbox->addWidget( m_button3 );
+ m_button1->hide();
+ m_button2->hide();
+ m_button3->hide();
+
+ frame2->hide();
+ gbox->addMultiCellWidget( frame2, 3, 3, 0, 2, 0 );
+
setFixedSize( sizeHint() );
setCaption( i18n("Please wait...") );
diff --git a/tdeui/kdialog.h b/tdeui/kdialog.h
index fff80a10c..dd1cc3908 100644
--- a/tdeui/kdialog.h
+++ b/tdeui/kdialog.h
@@ -234,6 +234,8 @@ public:
* @author Timothy Pearson <kb9vqf@pearsoncomputing.net>
*/
class TQLabel;
+class TQPushButton;
+class TQHBoxLayout;
class TDEUI_EXPORT KSMModalDialog : public TQWidget
{
Q_OBJECT
@@ -250,6 +252,12 @@ protected slots:
void keepMeOnTop();
void closeEvent(TQCloseEvent *e);
+protected:
+ TQPushButton* m_button1;
+ TQPushButton* m_button2;
+ TQPushButton* m_button3;
+ TQHBoxLayout* m_buttonbox;
+
private:
TQTimer* m_keepOnTopTimer;
TQLabel* m_statusLabel;