kmail

transportmanager.cpp
1/*
2 transportmanager.cpp
3
4 KMail, the KDE mail client.
5 Copyright (c) 2002 Ingo Kloecker <kloecker@kde.org>
6
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License,
9 version 2.0, as published by the Free Software Foundation.
10 You should have received a copy of the GNU General Public License
11 along with this program; if not, write to the Free Software Foundation,
12 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, US
13*/
14
15#ifdef HAVE_CONFIG_H
16#include <config.h>
17#endif
18
19#include "transportmanager.h"
20
21#include "kmtransport.h"
22#include "kmkernel.h"
23#include <tdeapplication.h>
24#include <tdeconfig.h>
25
26namespace KMail {
27
29 {
30 TDEConfigGroup general( KMKernel::config(), "General");
31
32 int numTransports = general.readNumEntry("transports", 0);
33
34 TQStringList transportNames;
35 for ( int i = 1 ; i <= numTransports ; i++ ) {
36 KMTransportInfo ti;
37 ti.readConfig(i);
38 transportNames << ti.name;
39 }
40
41 return transportNames;
42 }
43
44 // more or less copied from AccountManager
46 {
47 TQValueList<unsigned int> usedIds;
48
49 TDEConfigGroup general( KMKernel::config(), "General");
50 int numTransports = general.readNumEntry( "transports", 0 );
51
52 for ( int i = 1 ; i <= numTransports ; i++ ) {
53 KMTransportInfo ti;
54 ti.readConfig( i );
55 usedIds << ti.id();
56 }
57
58 usedIds << 0; // 0 is default for unknown
59 int newId;
60 do
61 {
62 newId = tdeApp->random();
63 } while ( usedIds.find(newId) != usedIds.end() );
64
65 return newId;
66 }
67
68} // namespace KMail
static unsigned int createId()
Create a unique id for a transport info item.
static TQStringList transportNames()
Returns the list for transport names.
folderdiaquotatab.h
Definition: aboutdata.cpp:40