~ubuntu-branches/ubuntu/hardy/newsbeuter/hardy-security

« back to all changes in this revision

Viewing changes to src/formaction.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Nico Golde
  • Date: 2007-05-08 18:35:46 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20070508183546-kxo88s8lrtdyz3gv
Tags: 0.4-1
* New upstream release.
* Removed dpatch dependency and patch for header inclusion,
  included upstream.
* Changed Build-Dependencies to nxml >= 0.17.2 and mrss >= 0.17.1.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <formaction.h>
 
2
#include <view.h>
 
3
 
 
4
namespace newsbeuter {
 
5
 
 
6
formaction::formaction(view * vv, std::string formstr) : v(vv), f(0), do_redraw(true) { 
 
7
        f = new stfl::form(formstr);
 
8
}
 
9
 
 
10
void formaction::set_keymap_hints() {
 
11
        f->set("help", prepare_keymap_hint(this->get_keymap_hint()));
 
12
}
 
13
 
 
14
formaction::~formaction() { 
 
15
        delete f;
 
16
}
 
17
 
 
18
stfl::form * formaction::get_form() {
 
19
        return f;
 
20
}
 
21
 
 
22
std::string formaction::prepare_keymap_hint(keymap_hint_entry * hints) {
 
23
        std::string keymap_hint;
 
24
        for (int i=0;hints[i].op != OP_NIL; ++i) {
 
25
                keymap_hint.append(v->get_keys()->getkey(hints[i].op));
 
26
                keymap_hint.append(":");
 
27
                keymap_hint.append(hints[i].text);
 
28
                keymap_hint.append(" ");
 
29
        }
 
30
        return keymap_hint;     
 
31
}
 
32
 
 
33
std::string formaction::get_value(const std::string& value) {
 
34
        return f->get(value);
 
35
}
 
36
 
 
37
}