Fix network-manager backend crash on certain systems when network-manager is not available

Add ability to show buttons in KSMModalDialog
pull/16/head
Timothy Pearson 12 years ago
parent efda5c30fc
commit bae793079f

@ -1689,19 +1689,26 @@ TDENetworkDeviceType::TDENetworkDeviceType TDENetworkConnectionManager_BackendNM
return TDENetworkDeviceType::BackendOnly; return TDENetworkDeviceType::BackendOnly;
} }
else { else {
// Query NM for the device type if (d->m_dbusDeviceString != "") {
TQT_DBusError error; // Query NM for the device type
d->m_dbusDeviceString = deviceInterfaceString(m_macAddress); TQT_DBusError error;
DBus::DeviceProxy genericDevice(NM_DBUS_SERVICE, d->m_dbusDeviceString); d->m_dbusDeviceString = deviceInterfaceString(m_macAddress);
genericDevice.setConnection(TQT_DBusConnection::systemBus()); DBus::DeviceProxy genericDevice(NM_DBUS_SERVICE, d->m_dbusDeviceString);
TDENetworkDeviceType::TDENetworkDeviceType ret = nmDeviceTypeToTDEDeviceType(genericDevice.getDeviceType(error)); genericDevice.setConnection(TQT_DBusConnection::systemBus());
if (error.isValid()) { TDENetworkDeviceType::TDENetworkDeviceType ret = nmDeviceTypeToTDEDeviceType(genericDevice.getDeviceType(error));
// Error! if (error.isValid()) {
PRINT_ERROR((error.name() + ": " + error.message())) // Error!
return TDENetworkDeviceType::Other; PRINT_ERROR((error.name() + ": " + error.message()))
return TDENetworkDeviceType::Other;
}
else {
return ret;
}
} }
else { else {
return ret; // Error!
PRINT_ERROR(TQString("Invalid DBUS device string '%1'").arg(d->m_dbusDeviceString))
return TDENetworkDeviceType::Other;
} }
} }
} }

@ -38,6 +38,7 @@
#include <tqlabel.h> #include <tqlabel.h>
#include <tqstyle.h> #include <tqstyle.h>
#include <tqimage.h> #include <tqimage.h>
#include <tqpushbutton.h>
#include "config.h" #include "config.h"
#ifdef Q_WS_X11 #ifdef Q_WS_X11
@ -419,13 +420,31 @@ KSMModalDialog::KSMModalDialog(TQWidget* parent)
fnt.setBold( false ); fnt.setBold( false );
fnt.setPointSize( fnt.pointSize() * 1 ); fnt.setPointSize( fnt.pointSize() * 1 );
m_statusLabel->setFont( fnt ); 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); KSMModalDialogHeader *theader = new KSMModalDialogHeader(this);
centerbox->addWidget( theader, AlignCenter ); centerbox->addWidget( theader, AlignCenter );
gbox->addLayout(centerbox, 0, 0); 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() ); setFixedSize( sizeHint() );
setCaption( i18n("Please wait...") ); setCaption( i18n("Please wait...") );

@ -234,6 +234,8 @@ public:
* @author Timothy Pearson <kb9vqf@pearsoncomputing.net> * @author Timothy Pearson <kb9vqf@pearsoncomputing.net>
*/ */
class TQLabel; class TQLabel;
class TQPushButton;
class TQHBoxLayout;
class TDEUI_EXPORT KSMModalDialog : public TQWidget class TDEUI_EXPORT KSMModalDialog : public TQWidget
{ {
Q_OBJECT Q_OBJECT
@ -250,6 +252,12 @@ protected slots:
void keepMeOnTop(); void keepMeOnTop();
void closeEvent(TQCloseEvent *e); void closeEvent(TQCloseEvent *e);
protected:
TQPushButton* m_button1;
TQPushButton* m_button2;
TQPushButton* m_button3;
TQHBoxLayout* m_buttonbox;
private: private:
TQTimer* m_keepOnTopTimer; TQTimer* m_keepOnTopTimer;
TQLabel* m_statusLabel; TQLabel* m_statusLabel;

Loading…
Cancel
Save