summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-10-22 10:09:10 (UTC)
committer zautrix <zautrix>2004-10-22 10:09:10 (UTC)
commit0af0436b73d0e55d4254aad66fb41efc06d329d1 (patch) (side-by-side diff)
tree397737fa9743c8769d109aab8c6174aea5df1cdb
parenta97485bb2ff1b4f274d9cf0fba9e2f122297deed (diff)
downloadkdepimpi-0af0436b73d0e55d4254aad66fb41efc06d329d1.zip
kdepimpi-0af0436b73d0e55d4254aad66fb41efc06d329d1.tar.gz
kdepimpi-0af0436b73d0e55d4254aad66fb41efc06d329d1.tar.bz2
removed debug output
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/vcard/VCardEntity.cpp4
-rw-r--r--kaddressbook/kabprefs.cpp1
2 files changed, 2 insertions, 3 deletions
diff --git a/kabc/vcard/VCardEntity.cpp b/kabc/vcard/VCardEntity.cpp
index 2a9e275..81debf4 100644
--- a/kabc/vcard/VCardEntity.cpp
+++ b/kabc/vcard/VCardEntity.cpp
@@ -1,175 +1,175 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1998 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <qregexp.h>
+#include <qdatetime.h>;
#include <VCardDefines.h>
#include <VCardVCardEntity.h>
using namespace VCARD;
VCardEntity::VCardEntity()
: Entity()
{
cardList_.setAutoDelete( TRUE );
}
VCardEntity::VCardEntity(const VCardEntity & x)
: Entity(x)
{
cardList_.setAutoDelete( TRUE );
}
VCardEntity::VCardEntity(const QCString & s)
: Entity(s)
{
cardList_.setAutoDelete( TRUE );
}
VCardEntity &
VCardEntity::operator = (VCardEntity & x)
{
if (*this == x) return *this;
Entity::operator = (x);
return *this;
}
VCardEntity &
VCardEntity::operator = (const QCString & s)
{
Entity::operator = (s);
return *this;
}
bool
VCardEntity::operator == (VCardEntity & x)
{
x.parse();
return false;
}
VCardEntity::~VCardEntity()
{
}
-#include <qdatetime.h>;
void
VCardEntity::_parse()
{
#if 0
QTime tim;
tim.start();
int num = 0;
// old code
vDebug("parse");
QCString s(strRep_);
int i = s.find(QRegExp("BEGIN:VCARD", false));
while (i != -1) {
i = s.find(QRegExp("BEGIN:VCARD", false), 11);
QCString cardStr(s.left(i));
VCard * v = new VCard(cardStr);
cardList_.append(v);
v->parse();
s.remove(0, i);
}
#else
// this code is up to 17 (!) times faster
int start = 0;
QTime tim;
tim.start();
int i = 11;
int len = strRep_.length();
int num = 0;
while (i < len ) {
while( i < len ) {
int add = 1;
if ( strRep_.at(i) == 'B' ) {
if ( i+add < len && strRep_.at(i+add++) == 'E')
if ( i+add < len && strRep_.at(i+add++) == 'G')
if ( i+add < len && strRep_.at(i+add++) == 'I')
if ( i+add < len && strRep_.at(i+add++) == 'N')
if ( i+add < len && strRep_.at(i+add++) == ':')
if ( i+add < len && strRep_.at(i+add++) == 'V')
if ( i+add < len && strRep_.at(i+add++) == 'C')
if ( i+add < len && strRep_.at(i+add++) == 'A')
if ( i+add < len && strRep_.at(i+add++) == 'R')
if ( i+add < len && strRep_.at(i+add++) == 'D')
if ( i+add < len && (strRep_.at(i+add) == '\r' || strRep_.at(i+add) == '\n' ))
break;
}
++i;
}
if ( i <= len ) {
++num;
char* dat = strRep_.data()+start;
VCard * v = new VCard( QCString ( dat,i-start ) );
start = i;
cardList_.append(v);
v->parse();
}
i+= 11;
}
#endif
- qDebug("***time %d found %d", tim.elapsed(), num);
+ //qDebug("***time %d found %d", tim.elapsed(), num);
}
void
VCardEntity::_assemble()
{
VCardListIterator it(cardList_);
for (; it.current(); ++it)
strRep_ += it.current()->asString() + "\r\n"; // One CRLF for luck.
}
VCardList &
VCardEntity::cardList()
{
parse();
return cardList_;
}
void
VCardEntity::setCardList(const VCardList & l)
{
parse();
//US cardList_ = l;
VCardListIterator it(l);
for (; it.current(); ++it) {
VCard* v = new VCard(*it.current());
cardList_.append(v);
}
}
diff --git a/kaddressbook/kabprefs.cpp b/kaddressbook/kabprefs.cpp
index 4b3ee47..79fff47 100644
--- a/kaddressbook/kabprefs.cpp
+++ b/kaddressbook/kabprefs.cpp
@@ -1,209 +1,208 @@
/*
This file is part of KAddressBook.
Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
//US#ifdef KAB_EMBEDDED
//#include <qstring.h>
//#endif //KAB_EMBEDDED
#include <qtextstream.h>
#include <qfile.h>
#include <stdlib.h>
#include <libkdepim/kpimglobalprefs.h>
#include <kconfig.h>
#include <klocale.h>
#include <kstaticdeleter.h>
//US#include <kdebug.h> // defines kdDebug()
#include "kabprefs.h"
KABPrefs *KABPrefs::sInstance = 0;
static KStaticDeleter<KABPrefs> staticDeleter;
KABPrefs::KABPrefs()
: KPimPrefs("kaddressbookrc")
{
mLocaleDict = 0;
mDetailsFont = QFont("helvetica",12);
KPrefs::setCurrentGroup( "Views" );
addItemBool( "HonorSingleClick", &mHonorSingleClick, false );
KPrefs::setCurrentGroup( "General" );
addItemBool( "AutomaticNameParsing", &mAutomaticNameParsing, true );
addItemInt( "CurrentIncSearchField", &mCurrentIncSearchField, 0 );
#ifdef KAB_EMBEDDED
addItemBool("AskForQuit",&mAskForQuit,true);
addItemBool("ToolBarHor",&mToolBarHor, true );
addItemBool("ToolBarUp",&mToolBarUp, false );
addItemBool("SearchWithReturn",&mSearchWithReturn, true );
addItemFont("DetailsFont",&mDetailsFont);
#endif //KAB_EMBEDDED
KPrefs::setCurrentGroup( "MainWindow" );
addItemBool( "JumpButtonBarVisible", &mJumpButtonBarVisible, false );
addItemBool( "DetailsPageVisible", &mDetailsPageVisible, true );
addItemIntList( "ExtensionsSplitter", &mExtensionsSplitter );
addItemIntList( "DetailsSplitter", &mDetailsSplitter );
addItemBool( "MultipleViewsAtOnce", &mMultipleViewsAtOnce, true );
KPrefs::setCurrentGroup( "Extensions_General" );
QStringList defaultExtensions;
defaultExtensions << "merge";
defaultExtensions << "distribution_list_editor";
addItemInt( "CurrentExtension", &mCurrentExtension, 0 );
addItemStringList( "ActiveExtensions", &mActiveExtensions, defaultExtensions );
KPrefs::setCurrentGroup( "Views" );
QString defaultView = i18n( "Default Table View" );
addItemString( "CurrentView", &mCurrentView, defaultView );
addItemStringList( "ViewNames", &mViewNames, defaultView );
KPrefs::setCurrentGroup( "Filters" );
addItemInt( "CurrentFilter", &mCurrentFilter, 0 );
}
KABPrefs::~KABPrefs()
{
//qDebug("KABPrefs::~KABPrefs() ");
setLocaleDict( 0 );
if ( mLocaleDict )
delete mLocaleDict;
}
KABPrefs *KABPrefs::instance()
{
if ( !sInstance ) {
#ifdef KAB_EMBEDDED
sInstance = staticDeleter.setObject( new KABPrefs() );
#else //KAB_EMBEDDED
//US the following line has changed ???. Why
staticDeleter.setObject( sInstance, new KABPrefs() );
#endif //KAB_EMBEDDED
sInstance->readConfig();
}
return sInstance;
}
void KABPrefs::setCategoryDefaults()
{
mCustomCategories.clear();
mCustomCategories << i18n( "Business" ) << i18n( "Family" ) << i18n( "School" )
<< i18n( "Customer" ) << i18n( "Friend" );
}
// US introduce a nonconst way to return the config object.
KConfig* KABPrefs::getConfig()
{
return config();
}
void KABPrefs::usrReadConfig()
{
QString fileName ;
#ifndef DESKTOP_VERSION
fileName= QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/";
#else
fileName = qApp->applicationDirPath () + "/kdepim/kaddressbook/";
#endif
int mPreferredLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage;
mLocaleDict = 0;
if ( mPreferredLanguage > 0 && mPreferredLanguage < 5 ) {
if ( mPreferredLanguage == 1 )
fileName = fileName+"germantranslation.txt";
else if ( mPreferredLanguage == 4 )
fileName = fileName+"usertranslation.txt";
else if ( mPreferredLanguage == 2 )
fileName = fileName+"frenchtranslation.txt";
else if ( mPreferredLanguage == 3 )
fileName = fileName+"italiantranslation.txt";
QFile file( fileName );
if (file.open( IO_ReadOnly ) ) {
QTextStream ts( &file );
ts.setEncoding( QTextStream::Latin1 );
//ts.setCodec( QTextCodec::latin1 );
QString text = ts.read();
file.close();
text.replace( QRegExp("\\\\n"), "\n" );
QString line;
QString we;
QString wt;
int br = 0;
int nbr;
nbr = text.find ( "},", br );
line = text.mid( br, nbr - br );
br = nbr+1;
int se, ee, st, et;
mLocaleDict = new QDict<QString>;
QString end = "{ \"\",\"\" }";
while ( (line != end) && (br > 1) ) {
//qDebug("%d *%s* ", br, line.latin1());
se = line.find("\"")+1;
et = line.findRev("\"",-1);
ee = line.find("\",\"");
st = ee+3;
we = line.mid( se, ee-se );
wt = line.mid( st, et-st );
//qDebug("*%s* *%s* ", we.latin1(), wt.latin1());
mLocaleDict->insert( we, new QString (wt) );
nbr = text.find ( "}", br );
line = text.mid( br, nbr - br );
br = nbr+1;
}
//qDebug("end *%s* ", end.latin1());
setLocaleDict( mLocaleDict );
} else {
qDebug("KO: Cannot find translation file %s",fileName.latin1() );
}
}
- qDebug("KABPrefs::usrReadConfig********************** ");
KPimPrefs::usrReadConfig();
}
/*US
void KABPrefs::usrSetDefaults()
{
KPimPrefs::usrSetDefaults();
}
void KABPrefs::usrReadConfig()
{
KPimPrefs::usrReadConfig();
}
void KABPrefs::usrWriteConfig()
{
KPimPrefs::usrWriteConfig();
}
*/