~ubuntu-branches/ubuntu/oneiric/psi/oneiric

« back to all changes in this revision

Viewing changes to src/accountdlg.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jan Niehusmann
  • Date: 2006-01-20 00:20:36 UTC
  • mfrom: (1.2.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20060120002036-7nw6yo6totip0ee5
Tags: 0.10-2
* Added upstream changelog (Closes: Bug#327748)
* Mention --no-gpg and --no-gpg-agent in manpage (Closes: Bug#204416)

Show diffs side-by-side

added added

removed removed

Lines of Context:
312
312
        {
313
313
                const UserAccount &acc = pa->userAccount();
314
314
                setText(0, pa->name());
315
 
                setPixmap(0, IconsetFactory::icon("psi/account"));
 
315
                //setPixmap(0, IconsetFactory::icon("psi/account"));
316
316
                Jid j = acc.jid;
317
317
                setText(1, acc.opt_host ? acc.host : j.host());
318
318
                setText(2, pa->isActive() ? AccountManageDlg::tr("Active") : AccountManageDlg::tr("Not active"));
321
321
 
322
322
        void stateChange( bool s)
323
323
        {
324
 
                if (!s) {
325
 
                        if (pa->eventQueue()->count()) {
326
 
                                setOn(!s);
327
 
                                QMessageBox::information(listView(), AccountManageDlg::tr("Error"), AccountManageDlg::tr("Unable to disable the account, as it has pending events."));
328
 
                                return;
329
 
                        }
330
 
 
331
 
                        if (pa->isActive()) {
332
 
                                if (QMessageBox::information(listView(), AccountManageDlg::tr("Disable Account"), AccountManageDlg::tr("The account is currently active.\nDo you want to log out ?"),QMessageBox::Yes,QMessageBox::No | QMessageBox::Default | QMessageBox::Escape, QMessageBox::NoButton) == QMessageBox::Yes) {
333
 
                                        pa->logout();
334
 
                                }
335
 
                                else {
336
 
                                        setOn(!s);
337
 
                                        return;
338
 
                                }
339
 
                        }
340
 
                }
341
 
 
342
324
                if (pa->enabled()!=s)
343
325
                        pa->setEnabled(s);
 
326
                updateInfo();
344
327
        }
345
328
 
346
329
        int rtti() const
593
576
        const UserAccount &acc = pa->userAccount();
594
577
 
595
578
        connect(pb_close, SIGNAL(clicked()), SLOT(reject()));
596
 
        connect(ck_pass, SIGNAL(toggled(bool)), le_pass, SLOT(setEnabled(bool)));
597
579
        connect(ck_host, SIGNAL(toggled(bool)), SLOT(hostToggled(bool)));
598
580
        connect(pb_key, SIGNAL(clicked()), SLOT(chooseKey()));
599
581
        connect(pb_keyclear, SIGNAL(clicked()), SLOT(clearKey()));
600
582
        connect(pb_save, SIGNAL(clicked()), SLOT(save()));
601
583
 
602
 
        le_pass->setEnabled(false);
 
584
        le_pass->setEnabled(true);
603
585
        le_host->setEnabled(false);
604
586
        le_port->setEnabled(false);
605
587
 
606
588
        gb_pgp->setEnabled(false);
607
 
        connect(ck_pp, SIGNAL(toggled(bool)), SLOT(optpp_toggled(bool)));
608
 
        le_pp->setEnabled(false);
609
589
 
610
590
        connect(pb_vcard, SIGNAL(clicked()), SLOT(detailsVCard()));
611
591
        connect(pb_changepw, SIGNAL(clicked()), SLOT(detailsChangePW()));
616
596
        ck_ssl->setChecked(acc.opt_ssl);
617
597
        connect(ck_ssl, SIGNAL(toggled(bool)), SLOT(sslToggled(bool)));
618
598
 
619
 
        if(acc.opt_pass) {
620
 
                ck_pass->setChecked(true);
 
599
        if (acc.opt_pass)
621
600
                le_pass->setText(acc.pass);
622
 
        }
623
601
 
624
602
        ck_host->setChecked(acc.opt_host);
625
603
        le_host->setText(acc.host);
640
618
        updateUserID();
641
619
        if(pa->psi()->pgp()) {
642
620
                gb_pgp->setEnabled(true);
643
 
                if(acc.opt_passphrase) {
644
 
                        ck_pp->setChecked(true);
645
 
                        le_pp->setText(acc.pgpPassphrase);
646
 
                }
647
621
        }
648
622
 
649
623
        pc = pa->psi()->proxy()->createProxyChooser(gb_proxy);
650
624
        replaceWidget(lb_proxychooser, pc);
651
 
        pc->fixTabbing(le_pp, ck_ssl);
652
625
        pc->setCurrentItem(acc.proxy_index);
653
626
 
654
627
        if(le_name->text().isEmpty())
695
668
                "server supports it and if you have the necessary QSSL "
696
669
                "plugin installed.  For more information, check the "
697
670
                "Psi homepage."));
698
 
        QWhatsThis::add(ck_pass,
699
 
                tr("Check this option if you want Psi to remember your Jabber "
700
 
                "account password. Don't use this feature if you want "
701
 
                "maximum security and don't want to be compromised even "
702
 
                "if someone would break in your system and steal your "
703
 
                "configuration files."));
704
671
        QWhatsThis::add(ck_host,
705
672
                tr("Use this option for manual configuration of your Jabber host "
706
673
                "if it is not the same as the host you are connecting to.  This option is mostly useful "
764
731
                lb_keyicon->setEnabled(true);
765
732
                lb_keyname->setEnabled(true);
766
733
                pb_keyclear->setEnabled(true);
767
 
                ck_pp->setEnabled(true);
768
734
        }
769
735
        else {
770
736
                lb_keyname->setText(tr("No Key Selected"));
771
737
                lb_keyicon->setEnabled(false);
772
738
                lb_keyname->setEnabled(false);
773
739
                pb_keyclear->setEnabled(false);
774
 
                ck_pp->setChecked(false);
775
 
                ck_pp->setEnabled(false);
776
740
        }
777
741
}
778
742
 
783
747
        }
784
748
        else {
785
749
                gb_pgp->setEnabled(false);
786
 
                ck_pp->setChecked(false);
787
750
        }
788
751
        updateUserID();
789
752
}
790
753
 
791
 
void AccountModifyDlg::optpp_toggled(bool b)
792
 
{
793
 
        if(b)
794
 
                le_pp->setEnabled(true);
795
 
        else {
796
 
                le_pp->setEnabled(false);
797
 
                le_pp->setText("");
798
 
        }
799
 
}
800
 
 
801
754
void AccountModifyDlg::setPassword(const QString &pw)
802
755
{
803
 
        le_pass->setText(pw);
 
756
        if (!le_pass->text().isEmpty())
 
757
                le_pass->setText(pw);
804
758
}
805
759
 
806
760
void AccountModifyDlg::sslToggled(bool on)
834
788
        if(!key.isEmpty()) {
835
789
                keyID = key;
836
790
                updateUserID();
837
 
                ck_pp->setChecked(false);
838
791
        }
839
792
}
840
793
 
889
842
 
890
843
        acc.name = le_name->text();
891
844
        acc.jid = le_jid->text();
892
 
        acc.opt_pass = ck_pass->isChecked();
893
 
        if(acc.opt_pass)
894
 
                acc.pass = le_pass->text();
895
 
        else
896
 
                acc.pass = "";
 
845
        acc.pass = le_pass->text();
 
846
        acc.opt_pass = !acc.pass.isEmpty();
897
847
 
898
848
        acc.opt_host = ck_host->isChecked();
899
849
        acc.host = le_host->text();
912
862
        acc.dtProxy = le_dtProxy->text();
913
863
 
914
864
        acc.pgpSecretKeyID = keyID;
915
 
        acc.opt_passphrase = ck_pp->isChecked();
916
 
        if(acc.opt_passphrase)
917
 
                acc.pgpPassphrase = le_pp->text();
918
 
        else
919
 
                acc.pgpPassphrase = "";
920
865
 
921
866
        acc.proxy_index = pc->currentItem();
922
867