~ubuntu-branches/ubuntu/wily/psi/wily

« back to all changes in this revision

Viewing changes to src/psi_profiles.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jan Niehusmann
  • Date: 2009-09-25 17:49:51 UTC
  • mfrom: (6.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20090925174951-lvm7kdap82o8xhn3
Tags: 0.13-1
* Updated to upstream version 0.13
* Set Standards-Version to 3.8.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
108
108
void UserAccount::reset()
109
109
{
110
110
        name = "Default";
111
 
        opt_enabled = TRUE;
112
 
        opt_auto = FALSE;
113
 
        tog_offline = TRUE;
114
 
        tog_away = TRUE;
115
 
        tog_hidden = FALSE;
116
 
        tog_agents = TRUE;
117
 
        tog_self = FALSE;
118
 
        customAuth = FALSE;
119
 
        req_mutual_auth = FALSE;
120
 
        legacy_ssl_probe = TRUE;
 
111
        opt_enabled = true;
 
112
        opt_auto = false;
 
113
        tog_offline = true;
 
114
        tog_away = true;
 
115
        tog_hidden = false;
 
116
        tog_agents = true;
 
117
        tog_self = false;
 
118
        customAuth = false;
 
119
        req_mutual_auth = false;
 
120
        legacy_ssl_probe = true;
121
121
        security_level = QCA::SL_None;
122
122
        ssl = SSL_Auto;
123
123
        jid = "";
124
124
        pass = "";
125
 
        opt_pass = FALSE;
 
125
        opt_pass = false;
126
126
        port = 5222;
127
 
        opt_host = FALSE;
 
127
        opt_host = false;
128
128
        host = "";
129
 
        opt_automatic_resource = TRUE;
 
129
        opt_automatic_resource = true;
130
130
        resource = "Psi";
131
131
        priority = 5;
132
 
        opt_keepAlive = TRUE;
 
132
        opt_keepAlive = true;
133
133
        allow_plain = XMPP::ClientStream::AllowPlainOverTLS;
134
 
        opt_compress = FALSE;
135
 
        opt_log = TRUE;
136
 
        opt_reconn = FALSE;
 
134
        opt_compress = false;
 
135
        opt_log = true;
 
136
        opt_reconn = false;
137
137
        opt_connectAfterSleep = false;
138
138
        opt_ignoreSSLWarnings = false;
139
139
 
144
144
        proxy_user = "";
145
145
        proxy_pass = "";
146
146
 
 
147
        stunPort = 3478;
 
148
 
147
149
        keybind.clear();
148
150
 
149
151
        roster.clear();
155
157
 
156
158
void UserAccount::fromOptions(OptionsTree *o, QString base)
157
159
{
 
160
        // WARNING: If you add any new option here, only read the option if
 
161
        // allSetOptions (defined below) contains the new option. If not
 
162
        // the code should just leave the default value from the reset()
 
163
        // call in place.
158
164
        optionsBase = base;
159
 
        
 
165
 
160
166
        reset();
161
167
 
 
168
        QStringList allSetOptions = o->getChildOptionNames(base, true, true);
 
169
 
162
170
        opt_enabled = o->getOption(base + ".enabled").toBool();
163
171
        opt_auto = o->getOption(base + ".auto").toBool();
164
172
        opt_keepAlive = o->getOption(base + ".keep-alive").toBool();
188
196
        // read password (we must do this after reading the jid, to decode properly)
189
197
        QString tmp = o->getOption(base + ".password").toString();
190
198
        if(!tmp.isEmpty()) {
191
 
                opt_pass = TRUE;
 
199
                opt_pass = true;
192
200
                pass = decodePassword(tmp, jid);
193
201
        }
194
202
        
260
268
        keybind.fromOptions(o, base + ".pgp-key-bindings");
261
269
 
262
270
        dtProxy = o->getOption(base + ".bytestreams-proxy").toString();
 
271
 
 
272
 
 
273
        if (allSetOptions.contains(base + ".stun-host")) {
 
274
                stunHost = o->getOption(base + ".stun-host").toString();
 
275
        }
 
276
        if (allSetOptions.contains(base + ".stun-port")) {
 
277
                int tmpPort = o->getOption(base + ".stun-port").toInt();
 
278
                // a few days in the 0.13-dev development cycle the code set
 
279
                // 0 as port when first adding this option. Ignore 0 for now
 
280
                // and use default
 
281
                if (tmpPort != 0) stunPort = tmpPort;
 
282
        }
 
283
 
 
284
        if (allSetOptions.contains(base + ".tls")) {
 
285
                tlsOverrideCert = o->getOption(base + ".tls.override-certificate").toByteArray();
 
286
                tlsOverrideDomain = o->getOption(base + ".tls.override-domain").toString();
 
287
        }
263
288
}
264
289
 
265
290
void UserAccount::toOptions(OptionsTree *o, QString base)
377
402
                o->setOption(groupBase + ".open", groupState[group].open);
378
403
                o->setOption(groupBase + ".rank", groupState[group].rank);
379
404
        }
380
 
                
 
405
 
381
406
        o->setOption(base + ".proxy-id", proxyID);
382
407
 
383
408
        keybind.toOptions(o, base + ".pgp-key-bindings");
384
409
        o->setOption(base + ".bytestreams-proxy", dtProxy.full());
385
 
        
 
410
 
 
411
        o->setOption(base + ".stun-host", stunHost);
 
412
        o->setOption(base + ".stun-port", QString::number(stunPort));
 
413
 
 
414
        o->setOption(base + ".tls.override-certificate", tlsOverrideCert);
 
415
        o->setOption(base + ".tls.override-domain", tlsOverrideDomain);
386
416
}
387
417
 
388
418
void UserAccount::fromXml(const QDomElement &a)
460
490
        // read password (we must do this after reading the jid, to decode properly)
461
491
        readEntry(a, "password", &pass);
462
492
        if(!pass.isEmpty()) {
463
 
                opt_pass = TRUE;
 
493
                opt_pass = true;
464
494
                pass = decodePassword(pass, jid);
465
495
        }
466
496
 
536
566
        dtProxy = str;
537
567
}
538
568
 
539
 
#if 0
540
 
 LEGOPTFIXME
541
 
void OptionsMigration::reset()
542
 
{
543
 
        bool nix, win, mac;
544
 
        nix = win = mac = FALSE;
545
 
 
546
 
#ifdef Q_WS_X11
547
 
        nix = TRUE;
548
 
#endif
549
 
#ifdef Q_WS_WIN
550
 
        win = TRUE;
551
 
#endif
552
 
#ifdef Q_WS_MAC
553
 
        mac = TRUE;
554
 
#endif
555
 
 
556
 
        // global
557
 
        mwgeom.setRect(64, 64, 150, 360);
558
 
        lastStatusString = "";
559
 
        useSound = TRUE;
560
 
        proxyList.clear();
561
 
        acc.clear();
562
 
 
563
 
        // LEGOPTP
564
 
        LEGOPTP.useleft = FALSE;
565
 
        LEGOPTP.singleclick = FALSE;
566
 
        LEGOPTP.hideMenubar = FALSE;
567
 
        LEGOPTP.defaultAction = 1;
568
 
        LEGOPTP.delChats = dcHour;
569
 
        LEGOPTP.browser = 0;
570
 
        LEGOPTP.alwaysOnTop = FALSE;
571
 
        LEGOPTP.keepSizes = TRUE;
572
 
        LEGOPTP.ignoreHeadline = FALSE;
573
 
        LEGOPTP.ignoreNonRoster = FALSE;
574
 
        LEGOPTP.excludeGroupChatsFromIgnore = TRUE;
575
 
        LEGOPTP.useDock = true;
576
 
        LEGOPTP.dockDCstyle = win ? TRUE: FALSE;
577
 
        LEGOPTP.dockHideMW = FALSE;
578
 
        LEGOPTP.dockToolMW = FALSE;
579
 
#ifdef Q_WS_MAC
580
 
        LEGOPTP.alertStyle = 0;
581
 
#else
582
 
        LEGOPTP.alertStyle = 2;
583
 
#endif
584
 
        LEGOPTP.popupMsgs = FALSE;
585
 
        LEGOPTP.popupChats = FALSE;
586
 
        LEGOPTP.popupHeadlines = FALSE;
587
 
        LEGOPTP.popupFiles = FALSE;
588
 
        LEGOPTP.noAwayPopup = FALSE;
589
 
        LEGOPTP.noUnlistedPopup = false;
590
 
        LEGOPTP.raise = FALSE;
591
 
        LEGOPTP.incomingAs = 0;
592
 
        LEGOPTP.askOnline = FALSE;
593
 
        LEGOPTP.askOffline = FALSE;
594
 
        LEGOPTP.rosterAnim = TRUE;
595
 
        LEGOPTP.autoVCardOnLogin = true;
596
 
        LEGOPTP.xmlConsoleOnLogin = false;
597
 
        LEGOPTP.asAway = 10;
598
 
        LEGOPTP.asXa = 30;
599
 
        LEGOPTP.asOffline = 0;
600
 
        LEGOPTP.use_asAway = TRUE;
601
 
        LEGOPTP.use_asXa = TRUE;
602
 
        LEGOPTP.use_asOffline = FALSE;
603
 
        LEGOPTP.asMessage = QObject::tr("Auto Status (idle)");
604
 
        LEGOPTP.scrollTo = TRUE;
605
 
        LEGOPTP.useEmoticons = false;
606
 
        LEGOPTP.alertOpenChats = true;
607
 
        LEGOPTP.raiseChatWindow = false;
608
 
        LEGOPTP.showSubjects = true;
609
 
        LEGOPTP.showCounter = false;
610
 
        LEGOPTP.chatSays = false;
611
 
        LEGOPTP.showGroupCounts = true;
612
 
        LEGOPTP.smallChats = false;
613
 
        LEGOPTP.brushedMetal = false;
614
 
        LEGOPTP.chatLineEdit = true;
615
 
        LEGOPTP.useTabs = false;
616
 
        LEGOPTP.usePerTabCloseButton = true;
617
 
        LEGOPTP.putTabsAtBottom = false;
618
 
        LEGOPTP.autoRosterSize = false;
619
 
        LEGOPTP.autoRosterSizeGrowTop = false;
620
 
        LEGOPTP.autoResolveNicksOnAdd = false;
621
 
        LEGOPTP.chatBgImage = "";
622
 
        LEGOPTP.rosterBgImage = "";
623
 
        LEGOPTP.autoCopy = false;
624
 
        LEGOPTP.useCaps = true;
625
 
        LEGOPTP.useRC = false;
626
 
 
627
 
        LEGOPTP.sp.clear();
628
 
        QString name;
629
 
        name = QObject::tr("Away from desk");
630
 
        LEGOPTP.sp[name] = StatusPreset(name, QObject::tr("I am away from my desk.  Leave a message."), STATUS_AWAY);;
631
 
        name = QObject::tr("Showering");
632
 
        LEGOPTP.sp[name] = StatusPreset(name, QObject::tr("I'm in the shower.  You'll have to wait for me to get out."), STATUS_AWAY);
633
 
        name = QObject::tr("Eating");
634
 
        LEGOPTP.sp[name] = StatusPreset(name, QObject::tr("Out eating.  Mmmm.. food."), STATUS_AWAY);
635
 
        name = QObject::tr("Sleep");
636
 
        LEGOPTP.sp[name] = StatusPreset(name, QObject::tr("Sleep is good.  Zzzzz"),STATUS_DND);
637
 
        name = QObject::tr("Work");
638
 
        LEGOPTP.sp[name] = StatusPreset(name, QObject::tr("Can't chat.  Gotta work."), STATUS_DND);
639
 
        name = QObject::tr("Air");
640
 
        LEGOPTP.sp[name] = StatusPreset(name, QObject::tr("Stepping out to get some fresh air."), STATUS_AWAY);
641
 
        name = QObject::tr("Movie");
642
 
        LEGOPTP.sp[name] = StatusPreset(name, QObject::tr("Out to a movie.  Is that OK with you?"), STATUS_AWAY);
643
 
        name = QObject::tr("Secret");
644
 
        LEGOPTP.sp[name] = StatusPreset(name, QObject::tr("I'm not available right now and that's all you need to know."), STATUS_XA);
645
 
        name = QObject::tr("Out for the night");
646
 
        LEGOPTP.sp[name] = StatusPreset(name, QObject::tr("Out for the night."), STATUS_AWAY);
647
 
        name = QObject::tr("Greece");
648
 
        LEGOPTP.sp[name] = StatusPreset(name, QObject::tr("I have gone to a far away place.  I will be back someday!"), STATUS_XA);
649
 
        LEGOPTP.recentStatus.clear();
650
 
 
651
 
        LEGOPTP.color[cOnline]    = QColor("#000000");
652
 
        LEGOPTP.color[cListBack]  = QColor("#FFFFFF");
653
 
        LEGOPTP.color[cAway]      = QColor("#004BB4");
654
 
        LEGOPTP.color[cDND]       = QColor("#7E0000");
655
 
        LEGOPTP.color[cOffline]   = QColor("#646464");
656
 
        LEGOPTP.color[cStatus]    = QColor("#808080");
657
 
        LEGOPTP.color[cProfileFore] = QColor("#FFFFFF");
658
 
        LEGOPTP.color[cProfileBack] = QColor("#969696");
659
 
        LEGOPTP.color[cGroupFore] = QColor("#5A5A5A");
660
 
        LEGOPTP.color[cGroupBack] = QColor("#F0F0F0");
661
 
        LEGOPTP.color[cAnimFront] = QColor("#000000");
662
 
        LEGOPTP.color[cAnimBack]        = QColor("#969696");
663
 
 
664
 
        LEGOPTP.font[fRoster] = QApplication::font().toString();
665
 
        LEGOPTP.font[fMessage] = QApplication::font().toString();
666
 
        LEGOPTP.font[fChat] = QApplication::font().toString();
667
 
        {
668
 
                QFont font = QApplication::font();
669
 
                font.setPointSize( font.pointSize() - 2 );
670
 
                LEGOPTP.font[fPopup] = font.toString();
671
 
        }
672
 
        LEGOPTP.clNewHeadings = false;
673
 
        LEGOPTP.outlineHeadings = false;
674
 
 
675
 
        LEGOPTP.player = "play";
676
 
        LEGOPTP.noAwaySound = FALSE;
677
 
 
678
 
        LEGOPTP.onevent[eMessage]    = ApplicationInfo::resourcesDir() + "/sound/chat2.wav";
679
 
        LEGOPTP.onevent[eChat1]      = ApplicationInfo::resourcesDir() + "/sound/chat1.wav";
680
 
        LEGOPTP.onevent[eChat2]      = ApplicationInfo::resourcesDir() + "/sound/chat2.wav";
681
 
        LEGOPTP.onevent[eSystem]     = ApplicationInfo::resourcesDir() + "/sound/chat2.wav";
682
 
        LEGOPTP.onevent[eHeadline]   = ApplicationInfo::resourcesDir() + "/sound/chat2.wav";
683
 
        LEGOPTP.onevent[eOnline]     = ApplicationInfo::resourcesDir() + "/sound/online.wav";
684
 
        LEGOPTP.onevent[eOffline]    = ApplicationInfo::resourcesDir() + "/sound/offline.wav";
685
 
        LEGOPTP.onevent[eSend]       = ApplicationInfo::resourcesDir() + "/sound/send.wav";
686
 
        LEGOPTP.onevent[eIncomingFT] = ApplicationInfo::resourcesDir() + "/sound/ft_incoming.wav";
687
 
        LEGOPTP.onevent[eFTComplete] = ApplicationInfo::resourcesDir() + "/sound/ft_complete.wav";
688
 
 
689
 
 
690
 
        LEGOPTP.sizeEventDlg = EventDlg::defaultSize();
691
 
        LEGOPTP.sizeChatDlg = ChatDlg::defaultSize();
692
 
        LEGOPTP.sizeTabDlg = ChatDlg::defaultSize(); //TODO: no!
693
 
 
694
 
        LEGOPTP.jidComplete = true;
695
 
        LEGOPTP.grabUrls = false;
696
 
        LEGOPTP.noGCSound = true;
697
 
 
698
 
        // toolbars
699
 
        LEGOPTP.toolbars.clear();
700
 
 
701
 
        Options::ToolbarPrefs tbDef;
702
 
        tbDef.name = QString::null;
703
 
        tbDef.on = false;
704
 
        tbDef.locked = false;
705
 
        tbDef.stretchable = false;
706
 
        tbDef.keys.clear();
707
 
 
708
 
        tbDef.dock = Qt::DockTop;
709
 
        tbDef.nl = true;
710
 
        tbDef.extraOffset = 0;
711
 
 
712
 
        tbDef.dirty = true;
713
 
 
714
 
        {
715
 
                Options::ToolbarPrefs tb[3];
716
 
                uint i;
717
 
                for (i = 0; i < sizeof(tb)/sizeof(Options::ToolbarPrefs); i++) {
718
 
                        tb[i] = tbDef;
719
 
                        tb[i].index = i + 1;
720
 
                }
721
 
 
722
 
                bool defaultEnableToolbars;
723
 
#ifdef Q_WS_MAC
724
 
                defaultEnableToolbars = false;
725
 
#else
726
 
                defaultEnableToolbars = true;
727
 
#endif
728
 
 
729
 
                // Imitate old Psi button layout by default
730
 
                tb[0].name = QObject::tr("Buttons");
731
 
                tb[0].on = defaultEnableToolbars;
732
 
                tb[0].locked = true;
733
 
                tb[0].stretchable = true;
734
 
                tb[0].keys << "button_options" << "button_status";
735
 
                tb[0].dock = Qt::DockBottom;
736
 
 
737
 
                tb[1].name = QObject::tr("Show contacts");
738
 
                tb[1].on = false;
739
 
                tb[1].locked = true;
740
 
                tb[1].keys << "show_offline" << "show_hidden" << "show_agents" << "show_self" << "show_statusmsg"; 
741
 
 
742
 
                tb[2].name = QObject::tr("Event notifier");
743
 
                tb[2].on = false;
744
 
                tb[2].locked = true;
745
 
                tb[2].stretchable = true;
746
 
                tb[2].keys << "event_notifier";
747
 
                tb[2].dock = Qt::DockBottom;
748
 
                tb[2].index = 0;
749
 
 
750
 
                for ( i = 0; i < sizeof(tb)/sizeof(Options::ToolbarPrefs); i++ )
751
 
                        LEGOPTP.toolbars["mainWin"].append( tb[i] );
752
 
        }
753
 
 
754
 
        // groupchat
755
 
        LEGOPTP.gcHighlighting = true;
756
 
        LEGOPTP.gcHighlights.clear();
757
 
 
758
 
        LEGOPTP.gcNickColoring = true;
759
 
        LEGOPTP.gcNickColors.clear();
760
 
 
761
 
        LEGOPTP.gcNickColors << "Blue";
762
 
        LEGOPTP.gcNickColors << "Green";
763
 
        LEGOPTP.gcNickColors << "Orange";
764
 
        LEGOPTP.gcNickColors << "Purple";
765
 
        LEGOPTP.gcNickColors << "Red";
766
 
 
767
 
        // popups
768
 
        LEGOPTP.ppIsOn        = false;
769
 
        LEGOPTP.ppOnline      = true;
770
 
        LEGOPTP.ppOffline     = true;
771
 
        LEGOPTP.ppStatus      = false;
772
 
        LEGOPTP.ppMessage     = true;
773
 
        LEGOPTP.ppChat        = true;
774
 
        LEGOPTP.ppHeadline    = true;
775
 
        LEGOPTP.ppFile        = true;
776
 
        LEGOPTP.ppJidClip     = 25;
777
 
        LEGOPTP.ppStatusClip  = -1;
778
 
        LEGOPTP.ppTextClip    = 300;
779
 
        LEGOPTP.ppHideTime    = 10000; // 10 sec
780
 
        LEGOPTP.ppBorderColor = QColor (0x52, 0x97, 0xF9);
781
 
 
782
 
        // Bouncing of the dock (Mac OS X)
783
 
        LEGOPTP.bounceDock = Options::BounceForever;
784
 
 
785
 
        // lockdown
786
 
        LEGOPTP.lockdown.roster   = false;
787
 
        LEGOPTP.lockdown.services = false;
788
 
 
789
 
        LEGOPTP.useTransportIconsForContacts = false;
790
 
 
791
 
        // iconsets
792
 
        LEGOPTP.systemIconset = "default";
793
 
        LEGOPTP.emoticons = QStringList("default");
794
 
        LEGOPTP.defaultRosterIconset = "default";
795
 
 
796
 
        LEGOPTP.serviceRosterIconset.clear();
797
 
        LEGOPTP.serviceRosterIconset["transport"]       = "crystal-service.jisp";
798
 
        LEGOPTP.serviceRosterIconset["aim"]     = "crystal-aim.jisp";
799
 
        LEGOPTP.serviceRosterIconset["gadugadu"]        = "crystal-gadugadu.jisp";
800
 
        LEGOPTP.serviceRosterIconset["icq"]     = "crystal-icq.jisp";
801
 
        LEGOPTP.serviceRosterIconset["msn"]     = "crystal-msn.jisp";
802
 
        LEGOPTP.serviceRosterIconset["yahoo"]   = "crystal-yahoo.jisp";
803
 
        LEGOPTP.serviceRosterIconset["sms"]     = "crystal-sms.jisp";
804
 
 
805
 
        LEGOPTP.customRosterIconset.clear();
806
 
 
807
 
        // roster sorting
808
 
        LEGOPTP.rosterContactSortStyle = Options::ContactSortStyle_Status;
809
 
        LEGOPTP.rosterGroupSortStyle   = Options::GroupSortStyle_Alpha;
810
 
        LEGOPTP.rosterAccountSortStyle = Options::AccountSortStyle_Alpha;
811
 
 
812
 
        // disco dialog
813
 
        LEGOPTP.discoItems = false;
814
 
        LEGOPTP.discoInfo  = true;
815
 
 
816
 
        // auto-auth
817
 
        LEGOPTP.autoAuth = false;
818
 
 
819
 
        // Notify authorization
820
 
        LEGOPTP.notifyAuth = false;
821
 
 
822
 
        // message events
823
 
        LEGOPTP.messageEvents = true;
824
 
        LEGOPTP.inactiveEvents = false;
825
 
 
826
 
        // event priority
827
 
        LEGOPTP.eventPriorityHeadline = 0;
828
 
        LEGOPTP.eventPriorityChat     = 1;
829
 
        LEGOPTP.eventPriorityMessage  = 1;
830
 
        LEGOPTP.eventPriorityAuth     = 2;
831
 
        LEGOPTP.eventPriorityFile     = 3;
832
 
        LEGOPTP.eventPriorityFile     = 2;
833
 
 
834
 
        // Last used path remembering
835
 
        LEGOPTP.lastPath = QDir::homeDirPath();
836
 
        LEGOPTP.lastSavePath = QDir::homeDirPath();
837
 
 
838
 
        // data transfer
839
 
        LEGOPTP.dtPort = 8010;
840
 
        LEGOPTP.dtExternal = "";
841
 
 
842
 
}
843
 
#endif
844
569
 
845
570
static ToolbarPrefs loadToolbarData( const QDomElement &e )
846
571
{
898
623
 
899
624
        QDomElement base = doc.documentElement();
900
625
        if(base.tagName() != "psiconf")
901
 
                return FALSE;
 
626
                return false;
902
627
        confver = base.attribute("version");
903
628
        if(confver != "1.0")
904
 
                return FALSE;
 
629
                return false;
905
630
 
906
631
        readEntry(base, "progver", &progver);
907
632
 
1523
1248
                }
1524
1249
        }
1525
1250
 
1526
 
        return TRUE;
 
1251
        return true;
1527
1252
}
1528
1253
 
1529
1254
void OptionsMigration::lateMigration()
1617
1342
        QStringList list = getProfilesList();
1618
1343
        for(QStringList::ConstIterator it = list.begin(); it != list.end(); ++it) {
1619
1344
                if((*it).lower() == name)
1620
 
                        return TRUE;
 
1345
                        return true;
1621
1346
        }
1622
 
        return FALSE;
 
1347
        return false;
1623
1348
}
1624
1349
 
1625
1350
bool profileNew(const QString &name)
1626
1351
{
1627
1352
        if(name.isEmpty())
1628
 
                return FALSE;
 
1353
                return false;
1629
1354
 
1630
1355
        // verify the string is sane
1631
1356
        for(int n = 0; n < (int)name.length(); ++n) {
1632
1357
                if(!name.at(n).isLetterOrNumber())
1633
 
                        return FALSE;
 
1358
                        return false;
1634
1359
        }
1635
1360
 
1636
1361
        // make it
1637
1362
        QDir d(ApplicationInfo::profilesDir());
1638
1363
        if(!d.exists())
1639
 
                return FALSE;
 
1364
                return false;
1640
1365
        QDir p(ApplicationInfo::profilesDir() + "/" + name);
1641
1366
        if(!p.exists()) {
1642
1367
                if (!d.mkdir(name))
1643
 
                        return FALSE;
 
1368
                        return false;
1644
1369
        }
1645
1370
 
1646
1371
        p.mkdir("history");
1647
1372
        p.mkdir("vcard");
1648
1373
 
1649
 
        return TRUE;
 
1374
        return true;
1650
1375
}
1651
1376
 
1652
1377
bool profileRename(const QString &oldname, const QString &name)
1654
1379
        // verify the string is sane
1655
1380
        for(int n = 0; n < (int)name.length(); ++n) {
1656
1381
                if(!name.at(n).isLetterOrNumber())
1657
 
                        return FALSE;
 
1382
                        return false;
1658
1383
        }
1659
1384
 
1660
1385
        // locate the folder
1661
1386
        QDir d(ApplicationInfo::profilesDir());
1662
1387
        if(!d.exists())
1663
 
                return FALSE;
 
1388
                return false;
1664
1389
        if(!d.rename(oldname, name))
1665
 
                return FALSE;
 
1390
                return false;
1666
1391
 
1667
 
        return TRUE;
 
1392
        return true;
1668
1393
}
1669
1394
 
1670
1395
static bool folderRemove(const QDir &_d)
1678
1403
                QFileInfo info(d, *it);
1679
1404
                if(info.isDir()) {
1680
1405
                        if(!folderRemove(QDir(info.filePath())))
1681
 
                                return FALSE;
 
1406
                                return false;
1682
1407
                }
1683
1408
                else {
1684
1409
                        //printf("deleting [%s]\n", info.filePath().latin1());
1687
1412
        }
1688
1413
        QString name = d.dirName();
1689
1414
        if(!d.cdUp())
1690
 
                return FALSE;
 
1415
                return false;
1691
1416
        //printf("removing folder [%s]\n", d.filePath(name).latin1());
1692
1417
        d.rmdir(name);
1693
1418
 
1694
 
        return TRUE;
 
1419
        return true;
1695
1420
}
1696
1421
 
1697
1422
bool profileDelete(const QString &path)
1698
1423
{
1699
1424
        QDir d(path);
1700
1425
        if(!d.exists())
1701
 
                return TRUE;
 
1426
                return true;
1702
1427
 
1703
1428
        return folderRemove(QDir(path));
1704
1429
}