4 * Copyright (c) 2000 Alexander Neundorf <alexander.neundorf@rz.tu-ilmenau.de>
6 * Requires the Qt widget libraries, available at no cost at
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 #include "kcmsambaimports.h"
24 #include "kcmsambaimports.moc"
34 ImportsView::ImportsView(QWidget
* parent
, KConfig
*config
) :
35 QWidget(parent
), configFile(config
), list(this) {
36 QBoxLayout
*topLayout
= new QVBoxLayout(this);
37 topLayout
->setMargin(KDialog::marginHint());
38 topLayout
->setSpacing(KDialog::spacingHint());
39 topLayout
->addWidget(&list
);
41 list
.setAllColumnsShowFocus(true);
42 list
.setShowSortIndicator(true);
43 list
.setMinimumSize(425, 200);
44 list
.addColumn(i18n("Type"), 50);
45 list
.addColumn(i18n("Resource"), 200);
46 list
.addColumn(i18n("Mounted Under"), 190);
48 this->setWhatsThis(i18n("This list shows the Samba and NFS shared"
49 " resources mounted on your system from other hosts. The \"Type\""
50 " column tells you whether the mounted resource is a Samba or an NFS"
51 " type of resource. The \"Resource\" column shows the descriptive name"
52 " of the shared resource. Finally, the third column, which is labeled"
53 " \"Mounted under\" shows the location on your system where the shared"
54 " resource is mounted.") );
57 QObject::connect(&timer
, SIGNAL(timeout()), this, SLOT(updateList()));
61 void ImportsView::updateList() {
65 QByteArray
s(""), strSource
, strMount
, strType
;
66 FILE *f
=popen("mount", "r");
73 if ((s
.contains(" nfs ")) || (s
.contains(" smbfs "))) {
74 strSource
=s
.left(s
.indexOf(" on /"));
75 strMount
=s
.mid(s
.indexOf(" on /")+4, s
.length());
76 if ((s
.contains(" nfs ")) || (s
.contains("/remote on ")))
78 else if (s
.contains(" smbfs "))
80 int pos(strMount
.indexOf(" type "));
82 pos
=strMount
.indexOf(" read/");
83 strMount
=strMount
.left(pos
);
84 new Q3ListViewItem(&list
,strType
,strSource
,strMount
);