author | korovkin <korovkin> | 2006-03-20 21:46:03 (UTC) |
---|---|---|
committer | korovkin <korovkin> | 2006-03-20 21:46:03 (UTC) |
commit | 14e09a10bff58fac21c14f3171bd0979b2fdbe17 (patch) (unidiff) | |
tree | 5ade4e83f386b4f93d86183e879b7f08a21a2ef9 | |
parent | 74546adb68bd3f17a75003671407c4a4e6b09e73 (diff) | |
download | opie-14e09a10bff58fac21c14f3171bd0979b2fdbe17.zip opie-14e09a10bff58fac21c14f3171bd0979b2fdbe17.tar.gz opie-14e09a10bff58fac21c14f3171bd0979b2fdbe17.tar.bz2 |
Quick fix: made dialog boxes fit into the 240x320 screen.
3 files changed, 26 insertions, 4 deletions
diff --git a/noncore/net/opietooth/manager/rfcommassigndialogbase.ui b/noncore/net/opietooth/manager/rfcommassigndialogbase.ui index ac574a7..04bda8f 100644 --- a/noncore/net/opietooth/manager/rfcommassigndialogbase.ui +++ b/noncore/net/opietooth/manager/rfcommassigndialogbase.ui | |||
@@ -1,44 +1,64 @@ | |||
1 | <!DOCTYPE UI><UI> | 1 | <!DOCTYPE UI><UI> |
2 | <class>RfcommAssignDialogBase</class> | 2 | <class>RfcommAssignDialogBase</class> |
3 | <widget> | 3 | <widget> |
4 | <class>QDialog</class> | 4 | <class>QDialog</class> |
5 | <property stdset="1"> | 5 | <property stdset="1"> |
6 | <name>name</name> | 6 | <name>name</name> |
7 | <cstring>RfcommAssignDialogBase</cstring> | 7 | <cstring>RfcommAssignDialogBase</cstring> |
8 | </property> | 8 | </property> |
9 | <property stdset="1"> | 9 | <property stdset="1"> |
10 | <name>geometry</name> | 10 | <name>geometry</name> |
11 | <rect> | 11 | <rect> |
12 | <x>0</x> | 12 | <x>0</x> |
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>289</width> | 14 | <width>361</width> |
15 | <height>343</height> | 15 | <height>343</height> |
16 | </rect> | 16 | </rect> |
17 | </property> | 17 | </property> |
18 | <property stdset="1"> | 18 | <property stdset="1"> |
19 | <name>sizePolicy</name> | ||
20 | <sizepolicy> | ||
21 | <hsizetype>7</hsizetype> | ||
22 | <vsizetype>7</vsizetype> | ||
23 | </sizepolicy> | ||
24 | </property> | ||
25 | <property stdset="1"> | ||
19 | <name>caption</name> | 26 | <name>caption</name> |
20 | <string>Rfcomm Bind</string> | 27 | <string>Rfcomm Bind</string> |
21 | </property> | 28 | </property> |
29 | <property> | ||
30 | <name>layoutMargin</name> | ||
31 | </property> | ||
32 | <property> | ||
33 | <name>layoutSpacing</name> | ||
34 | </property> | ||
22 | <vbox> | 35 | <vbox> |
23 | <property stdset="1"> | 36 | <property stdset="1"> |
24 | <name>margin</name> | 37 | <name>margin</name> |
25 | <number>11</number> | 38 | <number>4</number> |
26 | </property> | 39 | </property> |
27 | <property stdset="1"> | 40 | <property stdset="1"> |
28 | <name>spacing</name> | 41 | <name>spacing</name> |
29 | <number>6</number> | 42 | <number>4</number> |
30 | </property> | 43 | </property> |
31 | <widget> | 44 | <widget> |
32 | <class>QLabel</class> | 45 | <class>QLabel</class> |
33 | <property stdset="1"> | 46 | <property stdset="1"> |
34 | <name>name</name> | 47 | <name>name</name> |
35 | <cstring>TextLabel1</cstring> | 48 | <cstring>TextLabel1</cstring> |
36 | </property> | 49 | </property> |
37 | <property stdset="1"> | 50 | <property stdset="1"> |
51 | <name>sizePolicy</name> | ||
52 | <sizepolicy> | ||
53 | <hsizetype>7</hsizetype> | ||
54 | <vsizetype>7</vsizetype> | ||
55 | </sizepolicy> | ||
56 | </property> | ||
57 | <property stdset="1"> | ||
38 | <name>text</name> | 58 | <name>text</name> |
39 | <string>Bind device to a interface</string> | 59 | <string>Bind device to a interface</string> |
40 | </property> | 60 | </property> |
41 | </widget> | 61 | </widget> |
42 | </vbox> | 62 | </vbox> |
43 | </widget> | 63 | </widget> |
44 | </UI> | 64 | </UI> |
diff --git a/noncore/net/opietooth/manager/rfcommassigndialogimpl.cpp b/noncore/net/opietooth/manager/rfcommassigndialogimpl.cpp index 3fe2ea6..be720b8 100644 --- a/noncore/net/opietooth/manager/rfcommassigndialogimpl.cpp +++ b/noncore/net/opietooth/manager/rfcommassigndialogimpl.cpp | |||
@@ -1,137 +1,139 @@ | |||
1 | 1 | ||
2 | #include "rfcommassigndialogimpl.h" | 2 | #include "rfcommassigndialogimpl.h" |
3 | #include "rfcommassigndialogitem.h" | 3 | #include "rfcommassigndialogitem.h" |
4 | #include "rfcommconfhandler.h" | 4 | #include "rfcommconfhandler.h" |
5 | 5 | ||
6 | /* OPIE */ | 6 | /* OPIE */ |
7 | #include <qpe/config.h> | 7 | #include <qpe/config.h> |
8 | #include <qpe/qpeapplication.h> | 8 | #include <qpe/qpeapplication.h> |
9 | #include <opie2/odebug.h> | 9 | #include <opie2/odebug.h> |
10 | using namespace Opie::Core; | 10 | using namespace Opie::Core; |
11 | 11 | ||
12 | /* QT */ | 12 | /* QT */ |
13 | #include <qlayout.h> | 13 | #include <qlayout.h> |
14 | 14 | ||
15 | using namespace OpieTooth; | 15 | using namespace OpieTooth; |
16 | 16 | ||
17 | // TODO: write only the file in bluebase? | 17 | // TODO: write only the file in bluebase? |
18 | // muss rfcommd dann neu gestartet werden | 18 | // muss rfcommd dann neu gestartet werden |
19 | // sollte rfcomm bind all nicht eh default config sein ( polled das? - d.h. sobald nen gerät in der nähe ist bindet es? | 19 | // sollte rfcomm bind all nicht eh default config sein ( polled das? - d.h. sobald nen gerät in der nähe ist bindet es? |
20 | 20 | ||
21 | 21 | ||
22 | RfcommAssignDialog::RfcommAssignDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) | 22 | RfcommAssignDialog::RfcommAssignDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) |
23 | : RfcommAssignDialogBase( parent, name, modal, fl ) | 23 | : RfcommAssignDialogBase( parent, name, modal, fl ) |
24 | { | 24 | { |
25 | 25 | ||
26 | m_range = 5; | 26 | m_range = 5; |
27 | 27 | ||
28 | m_scrollView = new QScrollView( this ); | 28 | m_scrollView = new QScrollView( this ); |
29 | m_scrollView->setResizePolicy( QScrollView::AutoOneFit ); | 29 | m_scrollView->setResizePolicy( QScrollView::AutoOneFit ); |
30 | m_scrollView->setHScrollBarMode( QScrollView::AlwaysOff ); | 30 | m_scrollView->setHScrollBarMode( QScrollView::AlwaysOff ); |
31 | 31 | ||
32 | RfcommAssignDialogBaseLayout->addWidget( m_scrollView ); | 32 | RfcommAssignDialogBaseLayout->addWidget( m_scrollView ); |
33 | 33 | ||
34 | m_box = new QVBox( m_scrollView->viewport() ); | 34 | m_box = new QVBox( m_scrollView->viewport() ); |
35 | m_scrollView->addChild( m_box ); | 35 | m_scrollView->addChild( m_box ); |
36 | 36 | ||
37 | confHandler = new RfCommConfHandler( "/etc/bluetooth/rfcomm.conf" ); | 37 | confHandler = new RfCommConfHandler( "/etc/bluetooth/rfcomm.conf" ); |
38 | 38 | ||
39 | loadConfig(); | 39 | loadConfig(); |
40 | } | 40 | } |
41 | 41 | ||
42 | RfcommAssignDialog::~RfcommAssignDialog() | 42 | RfcommAssignDialog::~RfcommAssignDialog() |
43 | { | 43 | { |
44 | if ( confHandler ) | 44 | if ( confHandler ) |
45 | { | 45 | { |
46 | delete confHandler; | 46 | delete confHandler; |
47 | } | 47 | } |
48 | } | 48 | } |
49 | 49 | ||
50 | 50 | ||
51 | void RfcommAssignDialog::newDevice( const QString & mac ) | 51 | void RfcommAssignDialog::newDevice( const QString & mac ) |
52 | { | 52 | { |
53 | 53 | ||
54 | for ( int i = 0 ; i < m_range; i++ ) | 54 | for ( int i = 0 ; i < m_range; i++ ) |
55 | { | 55 | { |
56 | 56 | ||
57 | QMap<QString, RfCommConfObject*>::Iterator it; | 57 | QMap<QString, RfCommConfObject*>::Iterator it; |
58 | it = confHandler->foundEntries().find( QString("%1").arg( i ) ); | 58 | it = confHandler->foundEntries().find( QString("%1").arg( i ) ); |
59 | // make sure that rfcommX is not assigned yet | 59 | // make sure that rfcommX is not assigned yet |
60 | if ( it == confHandler->foundEntries().end() ) | 60 | if ( it == confHandler->foundEntries().end() ) |
61 | { | 61 | { |
62 | QDialog dialog( this, "newdevice", true, WStyle_ContextHelp ); | 62 | QDialog dialog( this, "newdevice", true, WStyle_ContextHelp ); |
63 | dialog.setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, | ||
64 | (QSizePolicy::SizeType)7, sizePolicy().hasHeightForWidth())); | ||
63 | 65 | ||
64 | RfcommDialogItem *newDev = new RfcommDialogItem( &dialog ); | 66 | RfcommDialogItem *newDev = new RfcommDialogItem( &dialog ); |
65 | newDev->setIdent( i ); | 67 | newDev->setIdent( i ); |
66 | newDev->setMac( mac ); | 68 | newDev->setMac( mac ); |
67 | 69 | ||
68 | if ( QPEApplication::execDialog( &dialog ) == QDialog::Accepted ) | 70 | if ( QPEApplication::execDialog( &dialog ) == QDialog::Accepted ) |
69 | { | 71 | { |
70 | RfcommDialogItem *rfcomm = new RfcommDialogItem( m_box ); | 72 | RfcommDialogItem *rfcomm = new RfcommDialogItem( m_box ); |
71 | m_itemList.insert( i , rfcomm ); | 73 | m_itemList.insert( i , rfcomm ); |
72 | rfcomm->setIdent( i ); | 74 | rfcomm->setIdent( i ); |
73 | rfcomm->setMac( mac ); | 75 | rfcomm->setMac( mac ); |
74 | rfcomm->setChannel( newDev->channel() ); | 76 | rfcomm->setChannel( newDev->channel() ); |
75 | rfcomm->setComment( newDev->comment() ); | 77 | rfcomm->setComment( newDev->comment() ); |
76 | odebug << "New device set up" << oendl; | 78 | odebug << "New device set up" << oendl; |
77 | } | 79 | } |
78 | } | 80 | } |
79 | } | 81 | } |
80 | } | 82 | } |
81 | 83 | ||
82 | void RfcommAssignDialog::loadConfig() | 84 | void RfcommAssignDialog::loadConfig() |
83 | { | 85 | { |
84 | 86 | ||
85 | //Config cfg( "bluetoothmanager-rfcommbind" ); | 87 | //Config cfg( "bluetoothmanager-rfcommbind" ); |
86 | 88 | ||
87 | for ( int i = 0 ; i < m_range; i++ ) | 89 | for ( int i = 0 ; i < m_range; i++ ) |
88 | { | 90 | { |
89 | // cfg.setGroup( QString("%1").arg( i ) ); | 91 | // cfg.setGroup( QString("%1").arg( i ) ); |
90 | RfcommDialogItem *rfcomm = new RfcommDialogItem( m_box ); | 92 | RfcommDialogItem *rfcomm = new RfcommDialogItem( m_box ); |
91 | m_itemList.insert( i , rfcomm ); | 93 | m_itemList.insert( i , rfcomm ); |
92 | rfcomm->setIdent( i ); | 94 | rfcomm->setIdent( i ); |
93 | QMap<QString, RfCommConfObject*>::Iterator it; | 95 | QMap<QString, RfCommConfObject*>::Iterator it; |
94 | it = confHandler->foundEntries().find( QString("%1").arg( i ) ); | 96 | it = confHandler->foundEntries().find( QString("%1").arg( i ) ); |
95 | if ( it != confHandler->foundEntries().end() ) | 97 | if ( it != confHandler->foundEntries().end() ) |
96 | { | 98 | { |
97 | odebug << "Found key in foundEntries() " << oendl; | 99 | odebug << "Found key in foundEntries() " << oendl; |
98 | rfcomm->setMac( it.data()->mac() ); | 100 | rfcomm->setMac( it.data()->mac() ); |
99 | rfcomm->setChannel( it.data()->channel() ); | 101 | rfcomm->setChannel( it.data()->channel() ); |
100 | rfcomm->setComment( it.data()->comment() ); | 102 | rfcomm->setComment( it.data()->comment() ); |
101 | } | 103 | } |
102 | /* Use rfcomm.conf directly for now | 104 | /* Use rfcomm.conf directly for now |
103 | * rfcomm->setMac( cfg.readEntry( "mac", "" ) ); | 105 | * rfcomm->setMac( cfg.readEntry( "mac", "" ) ); |
104 | * rfcomm->setChannel( cfg.readNumEntry( "channel", 1 ) ); | 106 | * rfcomm->setChannel( cfg.readNumEntry( "channel", 1 ) ); |
105 | * rfcomm->setComment( cfg.readEntry( "comment", "" ) ); | 107 | * rfcomm->setComment( cfg.readEntry( "comment", "" ) ); |
106 | */ | 108 | */ |
107 | } | 109 | } |
108 | } | 110 | } |
109 | 111 | ||
110 | 112 | ||
111 | void RfcommAssignDialog::saveConfig() | 113 | void RfcommAssignDialog::saveConfig() |
112 | { | 114 | { |
113 | 115 | ||
114 | //Config cfg( "bluetoothmanager-rfcommbind" ); | 116 | //Config cfg( "bluetoothmanager-rfcommbind" ); |
115 | 117 | ||
116 | QMap< int, RfcommDialogItem*>::Iterator it; | 118 | QMap< int, RfcommDialogItem*>::Iterator it; |
117 | 119 | ||
118 | QMap< QString, RfCommConfObject*> outMap; | 120 | QMap< QString, RfCommConfObject*> outMap; |
119 | 121 | ||
120 | for( it = m_itemList.begin(); it != m_itemList.end(); ++it ) | 122 | for( it = m_itemList.begin(); it != m_itemList.end(); ++it ) |
121 | { | 123 | { |
122 | 124 | ||
123 | //cfg.setGroup( QString("%1").arg( it.key() ) ); | 125 | //cfg.setGroup( QString("%1").arg( it.key() ) ); |
124 | RfcommDialogItem *rfcomm = it.data(); | 126 | RfcommDialogItem *rfcomm = it.data(); |
125 | 127 | ||
126 | 128 | ||
127 | outMap.insert( QString( "%1").arg( it.key() ), new RfCommConfObject( it.key(), rfcomm->mac(), rfcomm->channel(), rfcomm->comment() ) ); | 129 | outMap.insert( QString( "%1").arg( it.key() ), new RfCommConfObject( it.key(), rfcomm->mac(), rfcomm->channel(), rfcomm->comment() ) ); |
128 | 130 | ||
129 | 131 | ||
130 | //cfg.writeEntry( "mac", rfcomm->mac() ); | 132 | //cfg.writeEntry( "mac", rfcomm->mac() ); |
131 | //cfg.writeEntry( "channel", rfcomm->channel() ); | 133 | //cfg.writeEntry( "channel", rfcomm->channel() ); |
132 | //cfg.writeEntry( "comment", rfcomm->comment() ); | 134 | //cfg.writeEntry( "comment", rfcomm->comment() ); |
133 | } | 135 | } |
134 | 136 | ||
135 | confHandler->save( outMap ); | 137 | confHandler->save( outMap ); |
136 | 138 | ||
137 | } | 139 | } |
diff --git a/noncore/net/opietooth/manager/rfcommdialogitembase.ui b/noncore/net/opietooth/manager/rfcommdialogitembase.ui index f9817df..dd8f121 100644 --- a/noncore/net/opietooth/manager/rfcommdialogitembase.ui +++ b/noncore/net/opietooth/manager/rfcommdialogitembase.ui | |||
@@ -1,110 +1,110 @@ | |||
1 | <!DOCTYPE UI><UI> | 1 | <!DOCTYPE UI><UI> |
2 | <class>RfcommDialogItemBase</class> | 2 | <class>RfcommDialogItemBase</class> |
3 | <widget> | 3 | <widget> |
4 | <class>QWidget</class> | 4 | <class>QWidget</class> |
5 | <property stdset="1"> | 5 | <property stdset="1"> |
6 | <name>name</name> | 6 | <name>name</name> |
7 | <cstring>RfcommDialogItemBase</cstring> | 7 | <cstring>RfcommDialogItemBase</cstring> |
8 | </property> | 8 | </property> |
9 | <property stdset="1"> | 9 | <property stdset="1"> |
10 | <name>geometry</name> | 10 | <name>geometry</name> |
11 | <rect> | 11 | <rect> |
12 | <x>0</x> | 12 | <x>0</x> |
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>289</width> | 14 | <width>239</width> |
15 | <height>95</height> | 15 | <height>95</height> |
16 | </rect> | 16 | </rect> |
17 | </property> | 17 | </property> |
18 | <property stdset="1"> | 18 | <property stdset="1"> |
19 | <name>caption</name> | 19 | <name>caption</name> |
20 | <string>Form2</string> | 20 | <string>Form2</string> |
21 | </property> | 21 | </property> |
22 | <vbox> | 22 | <vbox> |
23 | <property stdset="1"> | 23 | <property stdset="1"> |
24 | <name>margin</name> | 24 | <name>margin</name> |
25 | <number>0</number> | 25 | <number>0</number> |
26 | </property> | 26 | </property> |
27 | <property stdset="1"> | 27 | <property stdset="1"> |
28 | <name>spacing</name> | 28 | <name>spacing</name> |
29 | <number>0</number> | 29 | <number>0</number> |
30 | </property> | 30 | </property> |
31 | <widget> | 31 | <widget> |
32 | <class>QGroupBox</class> | 32 | <class>QGroupBox</class> |
33 | <property stdset="1"> | 33 | <property stdset="1"> |
34 | <name>name</name> | 34 | <name>name</name> |
35 | <cstring>m_identLabel</cstring> | 35 | <cstring>m_identLabel</cstring> |
36 | </property> | 36 | </property> |
37 | <property stdset="1"> | 37 | <property stdset="1"> |
38 | <name>title</name> | 38 | <name>title</name> |
39 | <string></string> | 39 | <string></string> |
40 | </property> | 40 | </property> |
41 | <property> | 41 | <property> |
42 | <name>layoutMargin</name> | 42 | <name>layoutMargin</name> |
43 | </property> | 43 | </property> |
44 | <property> | 44 | <property> |
45 | <name>layoutSpacing</name> | 45 | <name>layoutSpacing</name> |
46 | </property> | 46 | </property> |
47 | <grid> | 47 | <grid> |
48 | <property stdset="1"> | 48 | <property stdset="1"> |
49 | <name>margin</name> | 49 | <name>margin</name> |
50 | <number>5</number> | 50 | <number>5</number> |
51 | </property> | 51 | </property> |
52 | <property stdset="1"> | 52 | <property stdset="1"> |
53 | <name>spacing</name> | 53 | <name>spacing</name> |
54 | <number>5</number> | 54 | <number>5</number> |
55 | </property> | 55 | </property> |
56 | <widget row="0" column="0" > | 56 | <widget row="0" column="0" > |
57 | <class>QLayoutWidget</class> | 57 | <class>QLayoutWidget</class> |
58 | <property stdset="1"> | 58 | <property stdset="1"> |
59 | <name>name</name> | 59 | <name>name</name> |
60 | <cstring>Layout3</cstring> | 60 | <cstring>Layout3</cstring> |
61 | </property> | 61 | </property> |
62 | <hbox> | 62 | <hbox> |
63 | <property stdset="1"> | 63 | <property stdset="1"> |
64 | <name>margin</name> | 64 | <name>margin</name> |
65 | <number>0</number> | 65 | <number>0</number> |
66 | </property> | 66 | </property> |
67 | <property stdset="1"> | 67 | <property stdset="1"> |
68 | <name>spacing</name> | 68 | <name>spacing</name> |
69 | <number>6</number> | 69 | <number>6</number> |
70 | </property> | 70 | </property> |
71 | <widget> | 71 | <widget> |
72 | <class>QLabel</class> | 72 | <class>QLabel</class> |
73 | <property stdset="1"> | 73 | <property stdset="1"> |
74 | <name>name</name> | 74 | <name>name</name> |
75 | <cstring>TextLabel4</cstring> | 75 | <cstring>TextLabel4</cstring> |
76 | </property> | 76 | </property> |
77 | <property stdset="1"> | 77 | <property stdset="1"> |
78 | <name>text</name> | 78 | <name>text</name> |
79 | <string>Mac</string> | 79 | <string>Mac</string> |
80 | </property> | 80 | </property> |
81 | </widget> | 81 | </widget> |
82 | <widget> | 82 | <widget> |
83 | <class>QLineEdit</class> | 83 | <class>QLineEdit</class> |
84 | <property stdset="1"> | 84 | <property stdset="1"> |
85 | <name>name</name> | 85 | <name>name</name> |
86 | <cstring>m_macAddress</cstring> | 86 | <cstring>m_macAddress</cstring> |
87 | </property> | 87 | </property> |
88 | </widget> | 88 | </widget> |
89 | <widget> | 89 | <widget> |
90 | <class>QLabel</class> | 90 | <class>QLabel</class> |
91 | <property stdset="1"> | 91 | <property stdset="1"> |
92 | <name>name</name> | 92 | <name>name</name> |
93 | <cstring>TextLabel5</cstring> | 93 | <cstring>TextLabel5</cstring> |
94 | </property> | 94 | </property> |
95 | <property stdset="1"> | 95 | <property stdset="1"> |
96 | <name>text</name> | 96 | <name>text</name> |
97 | <string>Channel</string> | 97 | <string>Channel</string> |
98 | </property> | 98 | </property> |
99 | </widget> | 99 | </widget> |
100 | <widget> | 100 | <widget> |
101 | <class>QComboBox</class> | 101 | <class>QComboBox</class> |
102 | <item> | 102 | <item> |
103 | <property> | 103 | <property> |
104 | <name>text</name> | 104 | <name>text</name> |
105 | <string>0</string> | 105 | <string>0</string> |
106 | </property> | 106 | </property> |
107 | </item> | 107 | </item> |
108 | <item> | 108 | <item> |
109 | <property> | 109 | <property> |
110 | <name>text</name> | 110 | <name>text</name> |