summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addressee.cpp3
-rw-r--r--kaddressbook/views/kaddressbookcardview.cpp2
-rw-r--r--microkde/kdecore/kstandarddirs.cpp10
3 files changed, 13 insertions, 2 deletions
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp
index 18b4d58..39d14bb 100644
--- a/kabc/addressee.cpp
+++ b/kabc/addressee.cpp
@@ -1466,65 +1466,66 @@ void Addressee::setNameFromString( const QString &str )
1466 while ( leftOffset < rightOffset ) { 1466 while ( leftOffset < rightOffset ) {
1467 if ( titles.contains( parts[ leftOffset ] ) ) { 1467 if ( titles.contains( parts[ leftOffset ] ) ) {
1468 prefix.append( ( prefix.isEmpty() ? "" : " ") + parts[ leftOffset ] ); 1468 prefix.append( ( prefix.isEmpty() ? "" : " ") + parts[ leftOffset ] );
1469 leftOffset++; 1469 leftOffset++;
1470 } else 1470 } else
1471 break; 1471 break;
1472 } 1472 }
1473 setPrefix( prefix ); 1473 setPrefix( prefix );
1474 1474
1475 if ( leftOffset < rightOffset ) { 1475 if ( leftOffset < rightOffset ) {
1476 setGivenName( parts[ leftOffset ] ); 1476 setGivenName( parts[ leftOffset ] );
1477 leftOffset++; 1477 leftOffset++;
1478 } 1478 }
1479 1479
1480 QString additionalName; 1480 QString additionalName;
1481 while ( leftOffset < rightOffset ) { 1481 while ( leftOffset < rightOffset ) {
1482 additionalName.append( ( additionalName.isEmpty() ? "" : " ") + parts[ leftOffset ] ); 1482 additionalName.append( ( additionalName.isEmpty() ? "" : " ") + parts[ leftOffset ] );
1483 leftOffset++; 1483 leftOffset++;
1484 } 1484 }
1485 setAdditionalName( additionalName ); 1485 setAdditionalName( additionalName );
1486 } 1486 }
1487} 1487}
1488 1488
1489QString Addressee::realName() const 1489QString Addressee::realName() const
1490{ 1490{
1491 if ( !formattedName().isEmpty() ) 1491 if ( !formattedName().isEmpty() )
1492 return formattedName(); 1492 return formattedName();
1493 1493
1494 QString n = assembledName(); 1494 QString n = assembledName();
1495 1495
1496 if ( n.isEmpty() ) 1496 if ( n.isEmpty() )
1497 n = name(); 1497 n = name();
1498 1498 if ( n.isEmpty() )
1499 n = organization();
1499 return n; 1500 return n;
1500} 1501}
1501 1502
1502QString Addressee::assembledName() const 1503QString Addressee::assembledName() const
1503{ 1504{
1504 QString name = prefix() + " " + givenName() + " " + additionalName() + " " + 1505 QString name = prefix() + " " + givenName() + " " + additionalName() + " " +
1505 familyName() + " " + suffix(); 1506 familyName() + " " + suffix();
1506 1507
1507 return name.simplifyWhiteSpace(); 1508 return name.simplifyWhiteSpace();
1508} 1509}
1509 1510
1510QString Addressee::fullEmail( const QString &email ) const 1511QString Addressee::fullEmail( const QString &email ) const
1511{ 1512{
1512 QString e; 1513 QString e;
1513 if ( email.isNull() ) { 1514 if ( email.isNull() ) {
1514 e = preferredEmail(); 1515 e = preferredEmail();
1515 } else { 1516 } else {
1516 e = email; 1517 e = email;
1517 } 1518 }
1518 if ( e.isEmpty() ) return QString::null; 1519 if ( e.isEmpty() ) return QString::null;
1519 1520
1520 QString text; 1521 QString text;
1521 if ( realName().isEmpty() ) 1522 if ( realName().isEmpty() )
1522 text = e; 1523 text = e;
1523 else 1524 else
1524 text = assembledName() + " <" + e + ">"; 1525 text = assembledName() + " <" + e + ">";
1525 1526
1526 return text; 1527 return text;
1527} 1528}
1528 1529
1529void Addressee::insertEmail( const QString &email, bool preferred ) 1530void Addressee::insertEmail( const QString &email, bool preferred )
1530{ 1531{
diff --git a/kaddressbook/views/kaddressbookcardview.cpp b/kaddressbook/views/kaddressbookcardview.cpp
index 2b40909..cce68b9 100644
--- a/kaddressbook/views/kaddressbookcardview.cpp
+++ b/kaddressbook/views/kaddressbookcardview.cpp
@@ -30,65 +30,65 @@
30#include <qapplication.h> 30#include <qapplication.h>
31 31
32#include <kabc/addressbook.h> 32#include <kabc/addressbook.h>
33#include <kabc/addressee.h> 33#include <kabc/addressee.h>
34#include <kconfig.h> 34#include <kconfig.h>
35#include <kdebug.h> 35#include <kdebug.h>
36#include <klocale.h> 36#include <klocale.h>
37 37
38#include "kabprefs.h" 38#include "kabprefs.h"
39#include "viewmanager.h" 39#include "viewmanager.h"
40 40
41 41
42#include "kaddressbookcardview.h" 42#include "kaddressbookcardview.h"
43 43
44#ifndef KAB_EMBEDDED 44#ifndef KAB_EMBEDDED
45extern "C" { 45extern "C" {
46 void *init_libkaddrbk_cardview() 46 void *init_libkaddrbk_cardview()
47 { 47 {
48 return ( new CardViewFactory ); 48 return ( new CardViewFactory );
49 } 49 }
50} 50}
51#endif //KAB_EMBEDDED 51#endif //KAB_EMBEDDED
52 52
53//////////////////////////////// 53////////////////////////////////
54// AddresseeCardViewItem (internal class) 54// AddresseeCardViewItem (internal class)
55class AddresseeCardViewItem : public CardViewItem 55class AddresseeCardViewItem : public CardViewItem
56{ 56{
57 public: 57 public:
58 AddresseeCardViewItem(const KABC::Field::List &fields, 58 AddresseeCardViewItem(const KABC::Field::List &fields,
59 bool showEmptyFields, 59 bool showEmptyFields,
60 KABC::AddressBook *doc, const KABC::Addressee &a, 60 KABC::AddressBook *doc, const KABC::Addressee &a,
61 CardView *parent) 61 CardView *parent)
62 : CardViewItem(parent, a.formattedName()), 62 : CardViewItem(parent, a.realName() ),
63 mFields( fields ), mShowEmptyFields(showEmptyFields), 63 mFields( fields ), mShowEmptyFields(showEmptyFields),
64 mDocument(doc), mAddressee(a) 64 mDocument(doc), mAddressee(a)
65 { 65 {
66 if ( mFields.isEmpty() ) { 66 if ( mFields.isEmpty() ) {
67 mFields = KABC::Field::defaultFields(); 67 mFields = KABC::Field::defaultFields();
68 } 68 }
69 refresh(); 69 refresh();
70 } 70 }
71 71
72 const KABC::Addressee &addressee() const { return mAddressee; } 72 const KABC::Addressee &addressee() const { return mAddressee; }
73 73
74 void refresh() 74 void refresh()
75 { 75 {
76 // Update our addressee, since it may have changed elsewhere 76 // Update our addressee, since it may have changed elsewhere
77 mAddressee = mDocument->findByUid(mAddressee.uid()); 77 mAddressee = mDocument->findByUid(mAddressee.uid());
78 78
79 if (!mAddressee.isEmpty()) 79 if (!mAddressee.isEmpty())
80 { 80 {
81 clearFields(); 81 clearFields();
82 82
83 // Try all the selected fields until we find one with text. 83 // Try all the selected fields until we find one with text.
84 // This will limit the number of unlabeled icons in the view 84 // This will limit the number of unlabeled icons in the view
85 KABC::Field::List::Iterator iter; 85 KABC::Field::List::Iterator iter;
86 for (iter = mFields.begin(); iter != mFields.end(); ++iter) 86 for (iter = mFields.begin(); iter != mFields.end(); ++iter)
87 { 87 {
88 // insert empty fields or not? not doing so saves a bit of memory and CPU 88 // insert empty fields or not? not doing so saves a bit of memory and CPU
89 // (during geometry calculations), but prevents having equally 89 // (during geometry calculations), but prevents having equally
90 // wide label columns in all cards, unless CardViewItem/CardView search 90 // wide label columns in all cards, unless CardViewItem/CardView search
91 // globally for the widest label. (anders) 91 // globally for the widest label. (anders)
92 //if (mShowEmptyFields || !(*iter)->value( mAddressee ).isEmpty()) 92 //if (mShowEmptyFields || !(*iter)->value( mAddressee ).isEmpty())
93 insertField((*iter)->label(), (*iter)->value( mAddressee )); 93 insertField((*iter)->label(), (*iter)->value( mAddressee ));
94 } 94 }
diff --git a/microkde/kdecore/kstandarddirs.cpp b/microkde/kdecore/kstandarddirs.cpp
index cf0d1ee..810c889 100644
--- a/microkde/kdecore/kstandarddirs.cpp
+++ b/microkde/kdecore/kstandarddirs.cpp
@@ -1269,64 +1269,74 @@ void KStandardDirs::addKDEDefaults()
1269//US if (getuid()) 1269//US if (getuid())
1270 if (true) 1270 if (true)
1271 { 1271 {
1272 localKdeDir = readEnvPath("MICROKDEHOME"); 1272 localKdeDir = readEnvPath("MICROKDEHOME");
1273 if (!localKdeDir.isEmpty()) 1273 if (!localKdeDir.isEmpty())
1274 { 1274 {
1275#ifdef _WIN32_ 1275#ifdef _WIN32_
1276 if (localKdeDir.at(localKdeDir.length()-1) != '\\') 1276 if (localKdeDir.at(localKdeDir.length()-1) != '\\')
1277 localKdeDir += '\\'; 1277 localKdeDir += '\\';
1278#else 1278#else
1279 if (localKdeDir.at(localKdeDir.length()-1) != '/') 1279 if (localKdeDir.at(localKdeDir.length()-1) != '/')
1280 localKdeDir += '/'; 1280 localKdeDir += '/';
1281#endif 1281#endif
1282 //QMessageBox::information( 0,"localKdeDir",localKdeDir, 1 ); 1282 //QMessageBox::information( 0,"localKdeDir",localKdeDir, 1 );
1283 } 1283 }
1284 else 1284 else
1285 { 1285 {
1286 QString confFile; 1286 QString confFile;
1287#ifdef DESKTOP_VERSION 1287#ifdef DESKTOP_VERSION
1288 confFile = qApp->applicationDirPath ()+ "/.microkdehome" ; 1288 confFile = qApp->applicationDirPath ()+ "/.microkdehome" ;
1289 QFileInfo fi ( confFile ); 1289 QFileInfo fi ( confFile );
1290 if ( !fi.exists() ) 1290 if ( !fi.exists() )
1291 confFile = QDir::homeDirPath() + "/.microkdehome"; 1291 confFile = QDir::homeDirPath() + "/.microkdehome";
1292 else 1292 else
1293 qDebug("Loading path info from " + confFile ); 1293 qDebug("Loading path info from " + confFile );
1294 1294
1295#else 1295#else
1296 confFile = QDir::homeDirPath() + "/.microkdehome"; 1296 confFile = QDir::homeDirPath() + "/.microkdehome";
1297#endif 1297#endif
1298 KConfig cfg ( confFile ); 1298 KConfig cfg ( confFile );
1299 cfg.setGroup("Global"); 1299 cfg.setGroup("Global");
1300 localKdeDir = cfg.readEntry( "MICROKDEHOME", QDir::homeDirPath() + "/kdepim/" ); 1300 localKdeDir = cfg.readEntry( "MICROKDEHOME", QDir::homeDirPath() + "/kdepim/" );
1301#ifdef DESKTOP_VERSION
1302 if ( localKdeDir.startsWith( "LOCAL:" ) ) {
1303#ifdef _WIN32_
1304 localKdeDir = qApp->applicationDirPath () + "\\"+ localKdeDir.mid( 6 );
1305#else
1306 localKdeDir = qApp->applicationDirPath () + "/"+ localKdeDir.mid( 6 );
1307#endif
1308 qDebug("Using local conf dir %s ",localKdeDir.latin1() );
1309 }
1310#endif
1301 } 1311 }
1302 } 1312 }
1303 else 1313 else
1304 { 1314 {
1305 // We treat root different to prevent root messing up the 1315 // We treat root different to prevent root messing up the
1306 // file permissions in the users home directory. 1316 // file permissions in the users home directory.
1307 localKdeDir = readEnvPath("MICROKDEROOTHOME"); 1317 localKdeDir = readEnvPath("MICROKDEROOTHOME");
1308 if (!localKdeDir.isEmpty()) 1318 if (!localKdeDir.isEmpty())
1309 { 1319 {
1310 if (localKdeDir.at(localKdeDir.length()-1) != '/') 1320 if (localKdeDir.at(localKdeDir.length()-1) != '/')
1311 localKdeDir += '/'; 1321 localKdeDir += '/';
1312 } 1322 }
1313 else 1323 else
1314 { 1324 {
1315//US struct passwd *pw = getpwuid(0); 1325//US struct passwd *pw = getpwuid(0);
1316//US localKdeDir = QFile::decodeName((pw && pw->pw_dir) ? pw->pw_dir : "/root") + "/.microkde/"; 1326//US localKdeDir = QFile::decodeName((pw && pw->pw_dir) ? pw->pw_dir : "/root") + "/.microkde/";
1317 qDebug("KStandardDirs::addKDEDefaults: 1 has to be fixed"); 1327 qDebug("KStandardDirs::addKDEDefaults: 1 has to be fixed");
1318 } 1328 }
1319 1329
1320 } 1330 }
1321 1331
1322//US localKdeDir = appDir(); 1332//US localKdeDir = appDir();
1323 1333
1324//US 1334//US
1325// qDebug("KStandardDirs::addKDEDefaults: localKdeDir=%s", localKdeDir.latin1()); 1335// qDebug("KStandardDirs::addKDEDefaults: localKdeDir=%s", localKdeDir.latin1());
1326 if (localKdeDir != "-/") 1336 if (localKdeDir != "-/")
1327 { 1337 {
1328 localKdeDir = KShell::tildeExpand(localKdeDir); 1338 localKdeDir = KShell::tildeExpand(localKdeDir);
1329 addPrefix(localKdeDir); 1339 addPrefix(localKdeDir);
1330 } 1340 }
1331 1341
1332 for (QStringList::ConstIterator it = kdedirList.begin(); 1342 for (QStringList::ConstIterator it = kdedirList.begin();