blob: 9ede1e1d4c3a37bcba34c1498997abe548cc2308 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
|
/****************************************************************************
** ui.h extension file, included from the uic-generated form implementation.
**
** If you want to add, delete, or rename functions or slots, use
** TQt Designer to update this file, preserving your code.
**
** You should not define a constructor or destructor in this file.
** Instead, write your code in functions called init() and destroy().
** These will automatically be called by the form's constructor and
** destructor.
*****************************************************************************/
void KbfxConfigDlgPlugins::init()
{
KbfxPanel->clear();
KbfxPanel->insertItem ( tr2i18n ( "Left Panel" ) ); // index = 0
KbfxPanel->insertItem ( tr2i18n ( "Right Panel" ) ); // index = 1
}
void KbfxConfigDlgPlugins::ChangeForm()
{
KbfxPanel->setCurrentItem ( 0 );
KbfxPluginSelector-> selectedListBox()-> clear();
KbfxPluginSelector-> availableListBox()-> clear();
KbfxPluginSelector-> selectedListBox()-> insertStringList ( ConfigInit().m_pluginsLeft );
KbfxPluginSelector-> availableListBox()-> insertStringList ( KbfxListPlugins ( 0 ) ); // list Left Panel Plugins
}
TQStringList KbfxConfigDlgPlugins::KbfxListPlugins ( int panel )
{
TQStringList _plugins;
_plugins.clear();
bool _not_present;
TQStringList::Iterator it_available;
TQStringList::Iterator it_requested;
KbfxPlasmaPluginLoader *_tmp = new KbfxPlasmaPluginLoader();
TQStringList allPlugins = _tmp -> scanPlugins();
delete _tmp;
for ( it_available = allPlugins.begin(); it_available != allPlugins.end(); ++it_available )
{
_not_present = TRUE;
if ( panel == 0 )
{
for ( it_requested = ConfigInit ().m_pluginsLeft.begin ();
it_requested != ConfigInit ().m_pluginsLeft.end (); ++it_requested )
{
if ( ( *it_available ).contains ( *it_requested ) > 0 )
{
_not_present = FALSE;
break;
}
}
}
if ( panel == 1 )
{
for ( it_requested = ConfigInit ().m_pluginsRight.begin ();
it_requested != ConfigInit ().m_pluginsRight.end (); ++it_requested )
{
if ( ( *it_available ).contains ( *it_requested ) > 0 )
{
_not_present = FALSE;
break;
}
}
}
if ( _not_present )
{
_plugins += ( *it_available );
}
}
kdDebug() << "Available PLUGINS: " << _plugins << endl;
return _plugins;
}
void KbfxConfigDlgPlugins::KbfxConfigurePluginButton_clicked()
{
KMessageBox::information ( 0, tr2i18n ( "<p align='center'>Not Implemented yet.</p>" ) );
}
void KbfxConfigDlgPlugins::KbfxPluginInfoButton_clicked()
{
KMessageBox::information ( 0, tr2i18n ( "<p align='center'>Not Implemented yet.</p>" ) );
}
void KbfxConfigDlgPlugins::KbfxSaveSelectedPlugins()
{
int _selectedPanel = KbfxPanel->currentItem();
TQStringList _plugins;
_plugins.clear();
int it;
int _num = KbfxPluginSelector-> selectedListBox()->count();
for ( it = 0; it < _num; ++it )
{
_plugins += KbfxPluginSelector -> selectedListBox() -> text ( it );
}
kdDebug() << "Selected PLUGINS: " << _plugins << endl;
if ( _selectedPanel == 0 )
{
ConfigInit().m_pluginsLeft = _plugins;
kdDebug() << "Saved to Left Panel... " << endl;
}
if ( _selectedPanel == 1 )
{
ConfigInit().m_pluginsRight = _plugins;
kdDebug() << "Saved to Right Panel... " << endl;
}
}
void KbfxConfigDlgPlugins::KbfxPanelSelected ( int _sel )
{
KbfxPluginSelector-> selectedListBox()-> clear();
KbfxPluginSelector-> availableListBox()-> clear();
if ( _sel )
{
KbfxPluginSelector-> selectedListBox()-> insertStringList ( ConfigInit().m_pluginsRight );
KbfxPluginSelector-> availableListBox()-> insertStringList ( KbfxListPlugins ( 1 ) ); // list Right Panel Plugins
}
else
{
KbfxPluginSelector-> selectedListBox()-> insertStringList ( ConfigInit().m_pluginsLeft );
KbfxPluginSelector-> availableListBox()-> insertStringList ( KbfxListPlugins ( 0 ) ); // list Left Panel Plugins
}
}
void KbfxConfigDlgPlugins::KbfxPluginSelector_movedDown ( TQListBoxItem * )
{
/* save current selection */
KbfxSaveSelectedPlugins();
}
void KbfxConfigDlgPlugins::KbfxPluginSelector_movedUp ( TQListBoxItem * )
{
/* save current selection */
KbfxSaveSelectedPlugins();
}
void KbfxConfigDlgPlugins::KbfxPluginSelector_removed ( TQListBoxItem * )
{
/* save current selection */
KbfxSaveSelectedPlugins();
}
void KbfxConfigDlgPlugins::KbfxPluginSelector_added ( TQListBoxItem * )
{
/* save current selection */
KbfxSaveSelectedPlugins();
}
|