summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings/mainwindow/addconnectionimp.cpp
blob: 84f1cf684a799234354bf03fefff706bafcc14d5 (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
#include "addconnectionimp.h"
#include <qlistview.h>
#if QT_VERSION < 300
#include <qlist.h>
#else
#include <qptrlist.h>
#endif
#include <qlabel.h>
#include <qheader.h>

/**
 * Constructor
 */
AddConnectionImp::AddConnectionImp(QWidget *parent, const char *name, WFlags f):AddConnection(parent, name, f){
  connect(registeredServicesList, SIGNAL(selectionChanged()), this, SLOT(changed()));
  registeredServicesList->header()->hide();
};

/**
 * The current item changed, update the discription.
 */
void AddConnectionImp::changed(){
  QListViewItem *item = registeredServicesList->currentItem();
  if(item)
    help->setText(list[item->text(0)]);
}

/**
 * Save a copy of newList for the discriptions and append them all to the view
 * @param newList the new list of possible interfaces
 */
void AddConnectionImp::addConnections(const QMap<QString, QString> &newList){
  list = newList;
  QMap<QString, QString>::Iterator it;
  for( it = list.begin(); it != list.end(); ++it )
    (void)new QListViewItem(registeredServicesList, it.key());
  registeredServicesList->setCurrentItem(registeredServicesList->firstChild());
}

// addserviceimp.cpp