~ubuntu-branches/ubuntu/edgy/psi/edgy

« back to all changes in this revision

Viewing changes to src/options/opt_events.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jan Niehusmann
  • Date: 2004-06-15 00:10:41 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040615001041-enywb6pcpe4sjsw6
Tags: 0.9.2-1
* New upstream release
* Set KDEDIR for ./configure so kde specific files get installed
* Don't install libpsiwidgets.so. It got installed in /usr/share
  where it doesn't belong. May be included (at a better location)
  later.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include "opt_events.h"
 
2
#include "common.h"
 
3
#include "iconwidget.h"
 
4
 
 
5
#include <qbuttongroup.h>
 
6
#include <qwhatsthis.h>
 
7
#include <qcheckbox.h>
 
8
#include <qradiobutton.h>
 
9
#include <qcombobox.h>
 
10
#include <qlineedit.h>
 
11
 
 
12
#include "opt_events-ui.h"
 
13
 
 
14
//----------------------------------------------------------------------------
 
15
// OptionsTabEvents
 
16
//----------------------------------------------------------------------------
 
17
 
 
18
OptionsTabEvents::OptionsTabEvents(QObject *parent)
 
19
: OptionsTab(parent, "events", "", tr("Events"), tr("The events behaviour"), "psi/system")
 
20
{
 
21
        w = 0;
 
22
}
 
23
 
 
24
QWidget *OptionsTabEvents::widget()
 
25
{
 
26
        if ( w )
 
27
                return 0;
 
28
 
 
29
        w = new OptEventsUI();
 
30
        OptEventsUI *d = (OptEventsUI *)w;
 
31
        connect(d->bg_alerts, SIGNAL(clicked(int)), SLOT(selectAlertStyle(int)));
 
32
 
 
33
        QWhatsThis::add(d->ck_popupMsgs,
 
34
                tr("Makes new incoming message windows pop up automatically when received."));
 
35
        QWhatsThis::add(d->ck_popupHeadlines,
 
36
                tr("Makes new incoming headlines pop up automatically when received."));
 
37
        QWhatsThis::add(d->ck_allowAwayPopup,
 
38
                tr("Normally, Psi will not autopopup events when you are away.  "
 
39
                "Set this option if you want them to popup anyway."));
 
40
        QWhatsThis::add(d->ck_allowUnlistedPopup,
 
41
                tr("Normally, Psi will not autopopup events from users not in your roster.  "
 
42
                "Set this option if you want them to popup anyway."));
 
43
        QWhatsThis::add(d->ck_raise,
 
44
                tr("Makes new incoming events bring the main window to the foreground."));
 
45
        QWhatsThis::add(d->ck_ignoreNonRoster,
 
46
                tr("Makes Psi ignore all incoming events from contacts"
 
47
                " not already in your list of contacts."));
 
48
        QWhatsThis::add(d->rb_aSolid,
 
49
                tr("Does not animate or blink incoming event icons on the main window as they are received."));
 
50
        QWhatsThis::add(d->rb_aBlink,
 
51
                tr("Makes all incoming event icons blink on the main window as events are received."));
 
52
        QWhatsThis::add(d->rb_aAnimate,
 
53
                tr("Animates incoming event icons on the main window as events are recieved."));
 
54
        QWhatsThis::add(d->ck_autoAuth,
 
55
                tr("Makes Psi automatically accept all authorization requests from <b>anyone</b>."));
 
56
 
 
57
        return w;
 
58
}
 
59
 
 
60
void OptionsTabEvents::applyOptions(Options *opt)
 
61
{
 
62
        if ( !w )
 
63
                return;
 
64
 
 
65
        OptEventsUI *d = (OptEventsUI *)w;
 
66
        opt->popupMsgs  = d->ck_popupMsgs->isChecked();
 
67
        opt->popupChats = d->ck_popupMsgs->isChecked();
 
68
        opt->popupHeadlines = d->ck_popupHeadlines->isChecked();
 
69
        opt->noAwayPopup = !d->ck_allowAwayPopup->isChecked();
 
70
        opt->noUnlistedPopup = !d->ck_allowUnlistedPopup->isChecked();
 
71
        opt->raise = d->ck_raise->isChecked();
 
72
        opt->ignoreNonRoster = d->ck_ignoreNonRoster->isChecked();
 
73
        opt->alertStyle = alertStyle;
 
74
        opt->autoAuth = d->ck_autoAuth->isChecked();
 
75
 
 
76
        opt->ppIsOn = d->ck_popupOn->isChecked();
 
77
        opt->ppMessage = d->ck_popupOnMessage->isChecked();
 
78
        opt->ppChat    = d->ck_popupOnMessage->isChecked();
 
79
        opt->ppHeadline = d->ck_popupOnHeadline->isChecked();
 
80
        opt->ppOnline  = d->ck_popupOnOnline->isChecked();
 
81
        opt->ppOffline = d->ck_popupOnOffline->isChecked();
 
82
        opt->ppStatus  = d->ck_popupOnStatus->isChecked();
 
83
}
 
84
 
 
85
void OptionsTabEvents::restoreOptions(const Options *opt)
 
86
{
 
87
        if ( !w )
 
88
                return;
 
89
 
 
90
        OptEventsUI *d = (OptEventsUI *)w;
 
91
        d->ck_popupMsgs->setChecked( opt->popupMsgs || opt->popupChats );
 
92
        d->ck_popupHeadlines->setChecked( opt->popupHeadlines );
 
93
        d->ck_allowAwayPopup->setChecked( !opt->noAwayPopup );
 
94
        d->ck_allowUnlistedPopup->setChecked( !opt->noUnlistedPopup );
 
95
        d->ck_raise->setChecked( opt->raise );
 
96
        d->ck_ignoreNonRoster->setChecked( opt->ignoreNonRoster );
 
97
        alertStyle = opt->alertStyle;
 
98
        d->bg_alerts->setButton( alertStyle );
 
99
        d->ck_autoAuth->setChecked( opt->autoAuth );
 
100
 
 
101
        d->ck_popupOn->setChecked( true );
 
102
        d->ck_popupOn->setChecked( opt->ppIsOn );
 
103
        d->ck_popupOnMessage->setChecked( opt->ppMessage || opt->ppChat );
 
104
        d->ck_popupOnHeadline->setChecked( opt->ppHeadline );
 
105
        d->ck_popupOnOnline->setChecked( opt->ppOnline );
 
106
        d->ck_popupOnOffline->setChecked( opt->ppOffline );
 
107
        d->ck_popupOnStatus->setChecked( opt->ppStatus );
 
108
}
 
109
 
 
110
void OptionsTabEvents::selectAlertStyle(int a)
 
111
{
 
112
        alertStyle = a;
 
113
}