You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
82 lines
2.6 KiB
82 lines
2.6 KiB
15 years ago
|
/*
|
||
|
* Copyright (C) 2005, Mart Kelder (mart.kde@hccnet.nl)
|
||
|
*
|
||
|
* 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 "kio_proto.h"
|
||
|
|
||
12 years ago
|
#include <tdeconfig.h>
|
||
15 years ago
|
#include <kdebug.h>
|
||
|
|
||
14 years ago
|
#include <tqmap.h>
|
||
15 years ago
|
|
||
12 years ago
|
TQMap< TQString, TQString >* KIO_Protocol::createConfig( TDEConfigGroup * group, const TQString& password ) const
|
||
15 years ago
|
{
|
||
14 years ago
|
TQMap< TQString, TQString > *result = new TQMap< TQString, TQString >;
|
||
15 years ago
|
|
||
|
result->insert( "name", group->readEntry( "name", "" ) );
|
||
|
result->insert( "server", group->readEntry( "server", "" ) );
|
||
|
result->insert( "port", group->readEntry( "port", "" ) );
|
||
|
result->insert( "username", group->readEntry( "username", "" ) );
|
||
|
result->insert( "password", password );
|
||
|
result->insert( "mailbox", group->readEntry( "mailbox", "" ) );
|
||
|
result->insert( "savepassword", group->readEntry( "savepassword", "false" ) );
|
||
|
result->insert( "ssl", group->readEntry( "ssl", "false" ) );
|
||
|
result->insert( "metadata", group->readEntry( "metadata", "" ) );
|
||
|
|
||
|
return result;
|
||
|
}
|
||
|
|
||
14 years ago
|
void KIO_Protocol::clearFields( TQMap<TQString, TQString> *map, const KIO_Protocol::Fields fields ) const
|
||
15 years ago
|
{
|
||
|
if( fields & server )
|
||
|
map->insert( "server", "" );
|
||
|
if( fields & port )
|
||
|
map->insert( "port", "" );
|
||
|
if( fields & username )
|
||
|
map->insert( "username", "" );
|
||
|
if( fields & password )
|
||
|
map->insert( "password", "" );
|
||
|
if( fields & mailbox )
|
||
|
map->insert( "mailbox", "" );
|
||
|
if( fields & save_password )
|
||
|
map->insert( "savepassword", "" );
|
||
|
if( fields & metadata )
|
||
|
map->insert( "metadata", "" );
|
||
|
}
|
||
|
|
||
14 years ago
|
void KIO_Protocol::readEntries( TQMap< TQString, TQString >* map ) const
|
||
15 years ago
|
{
|
||
14 years ago
|
TQMap< TQString, TQString> *metadata = new TQMap< TQString, TQString >;
|
||
15 years ago
|
|
||
13 years ago
|
if( map->contains( "metadata" ) )
|
||
15 years ago
|
{
|
||
13 years ago
|
TQStringList list = TQStringList::split( ",", *map->find( "metadata" ) );
|
||
14 years ago
|
TQStringList::Iterator it;
|
||
15 years ago
|
for( it = list.begin(); it != list.end(); ++it )
|
||
|
{
|
||
13 years ago
|
int split = (*it).find( '=' );
|
||
15 years ago
|
|
||
|
metadata->insert( (*it).left( split ), (*it).right( (*it).length() - split - 1 ) );
|
||
|
}
|
||
|
}
|
||
|
|
||
|
this->readEntries( map, metadata );
|
||
|
|
||
|
delete metadata;
|
||
|
}
|