~ubuntu-branches/ubuntu/utopic/psi/utopic

« back to all changes in this revision

Viewing changes to src/options/opt_status.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jan Niehusmann
  • Date: 2010-02-19 09:37:12 UTC
  • mfrom: (6.1.5 sid)
  • Revision ID: james.westby@ubuntu.com-20100219093712-e225xvm1wjcf1cgi
Tags: 0.14-2
* comment out only function which uses va_list to work around build
  problems on armel
* Set Standards-Version to 3.8.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
47
47
 
48
48
        QString s = tr("Makes Psi automatically set your status to \"away\" if your"
49
49
                " computer is idle for the specified amount of time.");
50
 
        QWhatsThis::add(d->ck_asAway, s);
51
 
        QWhatsThis::add(d->sb_asAway, s);
 
50
        d->ck_asAway->setWhatsThis(s);
 
51
        d->sb_asAway->setWhatsThis(s);
52
52
        s = tr("Makes Psi automatically set your status to \"extended away\" if your"
53
53
                " computer is idle for the specified amount of time.");
54
 
        QWhatsThis::add(d->ck_asXa, s);
55
 
        QWhatsThis::add(d->sb_asXa, s);
 
54
        d->ck_asXa->setWhatsThis(s);
 
55
        d->sb_asXa->setWhatsThis(s);
56
56
        s = tr("Makes Psi automatically set your status to \"offline\" if your"
57
57
                " computer is idle for the specified amount of time."
58
58
                "  This will disconnect you from the Jabber server.");
61
61
                d->sb_asXa->hide();
62
62
                d->lb_asXa->hide();
63
63
        }
64
 
        QWhatsThis::add(d->ck_asOffline, s);
65
 
        QWhatsThis::add(d->sb_asOffline, s);
 
64
        d->ck_asOffline->setWhatsThis( s);
 
65
        d->sb_asOffline->setWhatsThis( s);
66
66
 
67
 
        QWhatsThis::add(d->te_asMessage,
 
67
        d->te_asMessage->setWhatsThis(
68
68
                tr("Specifies an extended message to use if you allow Psi"
69
69
                " to set your status automatically.  See options above."));
70
70
 
76
76
        connect(d->le_sp_priority, SIGNAL(textChanged(const QString&)), SLOT(changeStatusPreset()));
77
77
        connect(d->cb_sp_status, SIGNAL(activated(int)), SLOT(changeStatusPreset()));
78
78
        
79
 
        QWhatsThis::add(d->pb_spNew,
 
79
        d->pb_spNew->setWhatsThis(
80
80
                tr("Press this button to create a new status message preset."));
81
 
        QWhatsThis::add(d->pb_spDelete,
 
81
        d->pb_spDelete->setWhatsThis(
82
82
                tr("Press this button to delete a status message preset."));
83
 
        QWhatsThis::add(d->cb_preset,
 
83
        d->cb_preset->setWhatsThis(
84
84
                tr("Use this list to select a status message preset"
85
85
                " to view or edit in the box to the bottom."));
86
 
        QWhatsThis::add(d->te_sp,
 
86
        d->te_sp->setWhatsThis(
87
87
                tr("You may edit the message here for the currently selected"
88
88
                " status message preset in the list to the above."));
89
 
        QWhatsThis::add(d->cb_sp_status,
 
89
        d->cb_sp_status->setWhatsThis(
90
90
                tr("Use this to choose the status that will be assigned to this preset"));
91
 
        QWhatsThis::add(d->le_sp_priority,
 
91
        d->le_sp_priority->setWhatsThis(
92
92
                tr("Fill in the priority that will be assigned to this preset."
93
93
                   " If no priority is given, the default account priority will be used."));
94
94
 
95
 
        QWhatsThis::add(d->ck_askOnline,
 
95
        d->ck_askOnline->setWhatsThis(
96
96
                tr("Jabber allows you to put extended status messages on"
97
97
                " all status types.  Normally, Psi does not prompt you for"
98
98
                " an extended message when you set your status to \"online\"."
114
114
        PsiOptions::instance()->setOption("options.status.auto-away.use-away", d->ck_asAway->isChecked());
115
115
        PsiOptions::instance()->setOption("options.status.auto-away.use-not-availible", d->ck_asXa->isChecked());
116
116
        PsiOptions::instance()->setOption("options.status.auto-away.use-offline", d->ck_asOffline->isChecked());
117
 
        PsiOptions::instance()->setOption("options.status.auto-away.message", d->te_asMessage->text());
 
117
        PsiOptions::instance()->setOption("options.status.auto-away.message", d->te_asMessage->toPlainText());
118
118
 
119
119
        
120
120
        foreach (QString name, deletedPresets) {
147
147
 
148
148
        OptStatusUI *d = (OptStatusUI *)w;
149
149
 
150
 
        d->sb_asAway->setMinValue(0);
151
 
        d->sb_asAway->setMaxValue(INT_MAX);
 
150
        d->sb_asAway->setMinimum(0);
 
151
        d->sb_asAway->setMaximum(INT_MAX);
152
152
        d->sb_asAway->setValue( PsiOptions::instance()->getOption("options.status.auto-away.away-after").toInt() );
153
 
        d->sb_asXa->setMinValue(0);
154
 
        d->sb_asXa->setMaxValue(INT_MAX);
 
153
        d->sb_asXa->setMinimum(0);
 
154
        d->sb_asXa->setMaximum(INT_MAX);
155
155
        d->sb_asXa->setValue( PsiOptions::instance()->getOption("options.status.auto-away.not-availible-after").toInt() );
156
 
        d->sb_asOffline->setMinValue(0);
157
 
        d->sb_asOffline->setMaxValue(INT_MAX);
 
156
        d->sb_asOffline->setMinimum(0);
 
157
        d->sb_asOffline->setMaximum(INT_MAX);
158
158
        d->sb_asOffline->setValue( PsiOptions::instance()->getOption("options.status.auto-away.offline-after").toInt() );
159
159
        /*if (PsiOptions::instance()->getOption("options.status.auto-away.away-after").toInt() <= 0 )
160
160
                PsiOptions::instance()->getOption("options.status.auto-away.use-away").toBool() = false;
188
188
        }
189
189
        
190
190
        
191
 
        d->cb_preset->insertStringList(presetNames);
 
191
        d->cb_preset->addItems(presetNames);
192
192
 
193
193
        if(d->cb_preset->count() >= 1) {
194
194
                d->cb_preset->setCurrentIndex(0);
223
223
        }
224
224
 
225
225
        StatusPreset preset;
226
 
        QString name = d->cb_preset->text(x);
 
226
        QString name = d->cb_preset->itemText(x);
227
227
        
228
228
        if (newPresets.contains(name)) {
229
229
                preset = newPresets[name];
253
253
 
254
254
        while(1) {
255
255
                bool ok = false;
256
 
                text = QInputDialog::getText(
 
256
                text = QInputDialog::getText(parentWidget,
257
257
                        CAP(tr("New Status Preset")),
258
258
                        tr("Please enter a name for the new status preset:"),
259
 
                        QLineEdit::Normal, text, &ok, parentWidget);
 
259
                        QLineEdit::Normal, text, &ok);
260
260
                if(!ok) {
261
261
                        return;
262
262
                }
271
271
        }
272
272
 
273
273
        newPresets[text].setName(text);
274
 
        d->cb_preset->insertItem(text);
275
 
        d->cb_preset->setCurrentItem(d->cb_preset->count()-1);
 
274
        d->cb_preset->addItem(text);
 
275
        d->cb_preset->setCurrentIndex(d->cb_preset->count()-1);
276
276
        selectStatusPreset(d->cb_preset->count()-1);
277
277
        d->te_sp->setFocus();
278
278
 
282
282
void OptionsTabStatus::removeStatusPreset()
283
283
{
284
284
        OptStatusUI *d = (OptStatusUI *)w;
285
 
        int id = d->cb_preset->currentItem();
 
285
        int id = d->cb_preset->currentIndex();
286
286
        if(id == -1)
287
287
                return;
288
288
 
289
289
        emit dataChanged();
290
290
 
291
 
        QString name = d->cb_preset->text(id);
 
291
        QString name = d->cb_preset->itemText(id);
292
292
        
293
293
        if (newPresets.contains(name)) {
294
294
                newPresets.remove(name);
295
295
        } else {
296
 
                deletedPresets += d->cb_preset->text(id);
297
 
                presets.remove(d->cb_preset->text(id));
 
296
                deletedPresets += d->cb_preset->itemText(id);
 
297
                presets.remove(d->cb_preset->itemText(id));
298
298
        }
299
299
        d->cb_preset->removeItem(id);
300
300
 
314
314
void OptionsTabStatus::changeStatusPreset()
315
315
{
316
316
        OptStatusUI *d = (OptStatusUI *)w;
317
 
        int id = d->cb_preset->currentItem();
 
317
        int id = d->cb_preset->currentIndex();
318
318
        if(id == -1)
319
319
                return;
320
320
 
321
321
        StatusPreset sp;
322
 
        sp.setMessage(d->te_sp->text());
 
322
        sp.setMessage(d->te_sp->toPlainText());
323
323
        if (d->le_sp_priority->text().isEmpty())
324
324
                sp.clearPriority();
325
325
        else
326
326
                sp.setPriority(d->le_sp_priority->text().toInt());
327
327
        sp.setStatus(d->cb_sp_status->status());
328
328
 
329
 
        QString name = d->cb_preset->text(id);
 
329
        QString name = d->cb_preset->itemText(id);
330
330
        
331
331
        sp.setName(name);
332
332
        if (newPresets.contains(name)) {