summaryrefslogtreecommitdiffstats
path: root/kcontrol/tdeio/main.cpp
blob: 7fb9b43944cf37b14f7f5f3dc654afa93fd39194 (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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
// (c) Torben Weis 1998
// (c) David Faure 1998
/*
 * main.cpp for lisa,reslisa,tdeio_lan and tdeio_rlan kcm module
 *
 *  Copyright (C) 2000,2001 Alexander Neundorf <neundorf@kde.org>
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */

#include <tqfile.h>
#include <tqlabel.h>
#include <tqlayout.h>
#include <tqtabwidget.h>

#include <tdecmoduleloader.h>
#include <tdelocale.h>

#include "kcookiesmain.h"
#include "netpref.h"
#include "smbrodlg.h"
#include "useragentdlg.h"
#include "kproxydlg.h"
#include "cache.h"

#include "main.h"

extern "C"
{

  KDE_EXPORT TDECModule *create_cookie(TQWidget *parent, const char /**name*/)
  {
    return new KCookiesMain(parent);
  }

  KDE_EXPORT TDECModule *create_smb(TQWidget *parent, const char /**name*/)
  {
    return new SMBRoOptions(parent);
  }

  KDE_EXPORT TDECModule *create_useragent(TQWidget *parent, const char /**name*/)
  {
    return new UserAgentDlg(parent);
  }

  KDE_EXPORT TDECModule *create_proxy(TQWidget *parent, const char /**name*/)
  {
    return new KProxyOptions(parent);
  }

  KDE_EXPORT TDECModule *create_cache(TQWidget *parent, const char /**name*/)
  {
    return new KCacheConfigDialog( parent );
  }

  KDE_EXPORT TDECModule *create_netpref(TQWidget *parent, const char /**name*/)
  {
    return new KIOPreferences(parent);
  }

  KDE_EXPORT TDECModule *create_lanbrowser(TQWidget *parent, const char *)
  {
    return new LanBrowser(parent);
  }

}

LanBrowser::LanBrowser(TQWidget *parent)
:TDECModule(parent,"kcmtdeio")
,layout(this)
,tabs(this)
,smbPageTabNumber(-1)
,lisaPageTabNumber(-1)
,tdeioLanPageTabNumber(-1)
{
   int currentTabNumber = 0;

   setQuickHelp( i18n("<h1>Local Network Browsing</h1>Here you setup your "
		"<b>\"Network Neighborhood\"</b>. You "
		"can use either the LISa daemon and the lan:/ ioslave, or the "
		"ResLISa daemon and the rlan:/ ioslave.<br><br>"
		"About the <b>LAN ioslave</b> configuration:<br> If you select it, the "
		"ioslave, <i>if available</i>, will check whether the host "
		"supports this service when you open this host. Please note "
		"that paranoid people might consider even this to be an attack.<br>"
		"<i>Always</i> means that you will always see the links for the "
		"services, regardless of whether they are actually offered by the host. "
		"<i>Never</i> means that you will never have the links to the services. "
		"In both cases you will not contact the host, so nobody will ever regard "
		"you as an attacker.<br><br>More information about <b>LISa</b> "
		"can be found at <a href=\"http://lisa-home.sourceforge.net\">"
		"the LISa Homepage</a> or contact Alexander Neundorf "
		"&lt;<a href=\"mailto:neundorf@kde.org\">neundorf@kde.org</a>&gt;."));

   layout.addWidget(&tabs);

   smbPage = create_smb(&tabs, 0);
   tabs.addTab(smbPage, i18n("&Windows Shares"));
   smbPageTabNumber = currentTabNumber;
   currentTabNumber++;
   connect(smbPage,TQT_SIGNAL(changed(bool)), TQT_SLOT( changed() ));

   lisaPage = TDECModuleLoader::loadModule("kcmlisa", TDECModuleLoader::None, &tabs);
   if (lisaPage)
   {
     tabs.addTab(lisaPage,i18n("&LISa Daemon"));
     lisaPageTabNumber = currentTabNumber;
     currentTabNumber++;
     connect(lisaPage,TQT_SIGNAL(changed()), TQT_SLOT( changed() ));
   }

//   resLisaPage = TDECModuleLoader::loadModule("kcmreslisa", &tabs);
//   if (resLisaPage)
//   {
//     tabs.addTab(resLisaPage,i18n("R&esLISa Daemon"));
//     connect(resLisaPage,TQT_SIGNAL(changed()), TQT_SLOT( changed() ));
//   }

   tdeioLanPage = TDECModuleLoader::loadModule("kcmtdeiolan",  TDECModuleLoader::None, &tabs);
   if (tdeioLanPage)
   {
     tabs.addTab(tdeioLanPage,i18n("lan:/ Iosla&ve"));
     tdeioLanPageTabNumber = currentTabNumber;
     currentTabNumber++;
     connect(tdeioLanPage,TQT_SIGNAL(changed()), TQT_SLOT( changed() ));
   }

   setButtons(Apply|Help);
   load();
}

void LanBrowser::load()
{
   smbPage->load();
   if (lisaPage)
     lisaPage->load();
//   if (resLisaPage)
//     resLisaPage->load();
   if (tdeioLanPage)
     tdeioLanPage->load();
   emit changed(false);
}

void LanBrowser::save()
{
   smbPage->save();
//   if (resLisaPage)
//     resLisaPage->save();
   if (tdeioLanPage)
     tdeioLanPage->save();
   if (lisaPage)
     lisaPage->save();
   emit changed(false);
}

TQString LanBrowser::handbookSection() const
{
	int index = tabs.currentPageIndex();
	if (index == smbPageTabNumber) {
		//return "windows-shares";
		return TQString::null;
	}
	else if (index == lisaPageTabNumber) {
		// FIXME
		// Documentation does not yet exist!
		return "";
	}
	else if (index == tdeioLanPageTabNumber) {
		// FIXME
		// Documentation does not yet exist!
		return "";
	}
	else {
		return TQString::null;
	}
}

#include "main.moc"