21 files changed, 38 insertions, 38 deletions
diff --git a/noncore/applets/zkbapplet/applet/zkbwidget.cpp b/noncore/applets/zkbapplet/applet/zkbwidget.cpp index 8499500..13729ea 100644 --- a/noncore/applets/zkbapplet/applet/zkbwidget.cpp +++ b/noncore/applets/zkbapplet/applet/zkbwidget.cpp | |||
@@ -1,92 +1,92 @@ | |||
1 | #include <opie2/otaskbarapplet.h> | 1 | #include <opie2/otaskbarapplet.h> |
2 | #include <opie2/okeyfilter.h> | 2 | #include <opie2/okeyfilter.h> |
3 | #include <qpe/qcopenvelope_qws.h> | 3 | #include <qpe/qcopenvelope_qws.h> |
4 | #include <qpe/applnk.h> | 4 | #include <qpe/applnk.h> |
5 | #include <qpe/qpeapplication.h> | 5 | #include <qpe/qpeapplication.h> |
6 | #include <qpe/resource.h> | 6 | #include <qpe/resource.h> |
7 | #include <stdio.h> | 7 | #include <stdio.h> |
8 | #include <unistd.h> | 8 | #include <unistd.h> |
9 | #include "zkbwidget.h" | 9 | #include "zkbwidget.h" |
10 | #include "zkbcfg.h" | 10 | #include "zkbcfg.h" |
11 | 11 | ||
12 | using namespace Opie::Ui; | 12 | using namespace Opie::Ui; |
13 | 13 | ||
14 | ZkbWidget::ZkbWidget(QWidget* parent) | 14 | ZkbWidget::ZkbWidget(QWidget* parent) |
15 | :QLabel(parent),keymap(0),disabled(Resource::loadPixmap("zkb-disabled")) { | 15 | :QLabel(parent),keymap(0),disabled(Resource::loadPixmap("zkb-disabled")) { |
16 | 16 | ||
17 | labels = new QPopupMenu(); | 17 | labels = new QPopupMenu(); |
18 | connect(labels, SIGNAL(activated(int)), this, | 18 | connect(labels, SIGNAL(activated(int)), this, |
19 | SLOT(labelChanged(int))); | 19 | SLOT(labelChanged(int))); |
20 | 20 | ||
21 | loadKeymap(); | 21 | loadKeymap(); |
22 | 22 | ||
23 | channel = new QCopChannel("QPE/zkb", this); | 23 | channel = new QCopChannel("QPE/zkb", this); |
24 | connect(channel, SIGNAL(received(const QCString&,const QByteArray&)), | 24 | connect(channel, SIGNAL(received(const QCString&,const QByteArray&)), |
25 | this, SLOT(signalReceived(const QCString&,const QByteArray&))); | 25 | this, SLOT(signalReceived(const QCString&,const QByteArray&))); |
26 | setFixedWidth ( AppLnk::smallIconSize() ); | 26 | setFixedWidth ( AppLnk::smallIconSize() ); |
27 | setFixedHeight ( AppLnk::smallIconSize() ); | 27 | setFixedHeight ( AppLnk::smallIconSize() ); |
28 | } | 28 | } |
29 | 29 | ||
30 | ZkbWidget::~ZkbWidget() | 30 | ZkbWidget::~ZkbWidget() |
31 | { | 31 | { |
32 | if (keymap != 0) { | 32 | if (keymap != 0) { |
33 | delete keymap; | 33 | delete keymap; |
34 | keymap = 0; | 34 | keymap = 0; |
35 | } | 35 | } |
36 | } | 36 | } |
37 | 37 | ||
38 | int ZkbWidget::position() | 38 | int ZkbWidget::position() |
39 | { | 39 | { |
40 | return 8; | 40 | return 8; |
41 | } | 41 | } |
42 | 42 | ||
43 | bool ZkbWidget::loadKeymap() { | 43 | bool ZkbWidget::loadKeymap() { |
44 | ZkbConfig c(QPEApplication::qpeDir()+"/share/zkb"); | 44 | ZkbConfig c(QPEApplication::qpeDir()+"share/zkb"); |
45 | QFontMetrics fm(font()); | 45 | QFontMetrics fm(font()); |
46 | 46 | ||
47 | if (keymap != 0) { | 47 | if (keymap != 0) { |
48 | delete keymap; | 48 | delete keymap; |
49 | keymap = 0; | 49 | keymap = 0; |
50 | } | 50 | } |
51 | 51 | ||
52 | Keymap* km = new Keymap(); | 52 | Keymap* km = new Keymap(); |
53 | 53 | ||
54 | if (!c.load("zkb.xml", *km, "")) { | 54 | if (!c.load("zkb.xml", *km, "")) { |
55 | delete km; | 55 | delete km; |
56 | setPixmap(disabled); | 56 | setPixmap(disabled); |
57 | return false; | 57 | return false; |
58 | } | 58 | } |
59 | 59 | ||
60 | connect(km, SIGNAL(stateChanged(const QString&)), | 60 | connect(km, SIGNAL(stateChanged(const QString&)), |
61 | this, SLOT(stateChanged(const QString&))); | 61 | this, SLOT(stateChanged(const QString&))); |
62 | 62 | ||
63 | Opie::Core::OKeyFilter::inst()->addHandler(km); | 63 | Opie::Core::OKeyFilter::inst()->addHandler(km); |
64 | 64 | ||
65 | Keymap* oldkm = keymap; | 65 | Keymap* oldkm = keymap; |
66 | keymap = km; | 66 | keymap = km; |
67 | 67 | ||
68 | if (oldkm != 0) { | 68 | if (oldkm != 0) { |
69 | delete oldkm; | 69 | delete oldkm; |
70 | } | 70 | } |
71 | 71 | ||
72 | QString ltext = keymap->getCurrentLabel(); | 72 | QString ltext = keymap->getCurrentLabel(); |
73 | if (ltext.length()==0) ltext = "??"; | 73 | if (ltext.length()==0) ltext = "??"; |
74 | setText(ltext); | 74 | setText(ltext); |
75 | 75 | ||
76 | labels->clear(); | 76 | labels->clear(); |
77 | QStringList l = keymap->listLabels(); | 77 | QStringList l = keymap->listLabels(); |
78 | labels->insertItem(disabled, 0, 0); | 78 | labels->insertItem(disabled, 0, 0); |
79 | int n = 1; | 79 | int n = 1; |
80 | w = 0; | 80 | w = 0; |
81 | for(QStringList::Iterator it = l.begin(); it != l.end(); | 81 | for(QStringList::Iterator it = l.begin(); it != l.end(); |
82 | ++it, n++) { | 82 | ++it, n++) { |
83 | 83 | ||
84 | // printf("label: %s\n", (const char*) (*it).utf8()); | 84 | // printf("label: %s\n", (const char*) (*it).utf8()); |
85 | 85 | ||
86 | labels->insertItem(*it, n, n); | 86 | labels->insertItem(*it, n, n); |
87 | int lw = fm.width(*it); | 87 | int lw = fm.width(*it); |
88 | if (lw > w) { | 88 | if (lw > w) { |
89 | w = lw; | 89 | w = lw; |
90 | } | 90 | } |
91 | } | 91 | } |
92 | 92 | ||
diff --git a/noncore/applets/zkbapplet/keyzcfg/cfgdlg.cpp b/noncore/applets/zkbapplet/keyzcfg/cfgdlg.cpp index 8d868d4..4190a9e 100644 --- a/noncore/applets/zkbapplet/keyzcfg/cfgdlg.cpp +++ b/noncore/applets/zkbapplet/keyzcfg/cfgdlg.cpp | |||
@@ -23,110 +23,110 @@ CfgDlg::CfgDlg(QWidget* parent, CfgFile* cf, QApplication* app, bool mod): | |||
23 | connect(delButton, SIGNAL(clicked()), this, SLOT(del())); | 23 | connect(delButton, SIGNAL(clicked()), this, SLOT(del())); |
24 | QPushButton* slabelButton = new QPushButton("Set Label", this); //apply->setText("Apply"); | 24 | QPushButton* slabelButton = new QPushButton("Set Label", this); //apply->setText("Apply"); |
25 | connect(slabelButton, SIGNAL(clicked()), this, SLOT(setLabel())); | 25 | connect(slabelButton, SIGNAL(clicked()), this, SLOT(setLabel())); |
26 | QLabel* l = new QLabel("Label", this); | 26 | QLabel* l = new QLabel("Label", this); |
27 | label = new QLineEdit(this); | 27 | label = new QLineEdit(this); |
28 | QLabel* adlabel = new QLabel("Auto Repeat Delay (ms)", this); | 28 | QLabel* adlabel = new QLabel("Auto Repeat Delay (ms)", this); |
29 | QLabel* aplabel = new QLabel("Auto Repeat Period (ms)", this); | 29 | QLabel* aplabel = new QLabel("Auto Repeat Period (ms)", this); |
30 | ad = new QSpinBox(50, 5000, 5, this); | 30 | ad = new QSpinBox(50, 5000, 5, this); |
31 | ap = new QSpinBox(0, 5000, 5, this); | 31 | ap = new QSpinBox(0, 5000, 5, this); |
32 | 32 | ||
33 | //QLabel* adms = new QLabel("ms", this); | 33 | //QLabel* adms = new QLabel("ms", this); |
34 | //QLabel* apms = new QLabel("ms", this); | 34 | //QLabel* apms = new QLabel("ms", this); |
35 | 35 | ||
36 | //QCheckBox* enable = new QCheckBox("Enable", t); | 36 | //QCheckBox* enable = new QCheckBox("Enable", t); |
37 | 37 | ||
38 | gl->setColStretch(0, 1); | 38 | gl->setColStretch(0, 1); |
39 | gl->setColStretch(1, 1); | 39 | gl->setColStretch(1, 1); |
40 | gl->setColStretch(3, 1); | 40 | gl->setColStretch(3, 1); |
41 | gl->setColStretch(4, 1); | 41 | gl->setColStretch(4, 1); |
42 | gl->setRowStretch(3, 1); | 42 | gl->setRowStretch(3, 1); |
43 | gl->addMultiCellWidget(flabel, 0, 0, 0, 1); | 43 | gl->addMultiCellWidget(flabel, 0, 0, 0, 1); |
44 | gl->addMultiCellWidget(klabel, 0, 0, 3, 4); | 44 | gl->addMultiCellWidget(klabel, 0, 0, 3, 4); |
45 | gl->addMultiCellWidget(files, 1, 3, 0, 1); | 45 | gl->addMultiCellWidget(files, 1, 3, 0, 1); |
46 | gl->addMultiCellWidget(keymaps, 1, 3, 3, 4); | 46 | gl->addMultiCellWidget(keymaps, 1, 3, 3, 4); |
47 | gl->addWidget(addButton, 1, 2); | 47 | gl->addWidget(addButton, 1, 2); |
48 | gl->addWidget(delButton, 2, 2); | 48 | gl->addWidget(delButton, 2, 2); |
49 | 49 | ||
50 | gl->addWidget(l, 4, 0); | 50 | gl->addWidget(l, 4, 0); |
51 | gl->addWidget(label, 4, 1); | 51 | gl->addWidget(label, 4, 1); |
52 | gl->addMultiCellWidget(slabelButton, 4, 4, 3, 4); | 52 | gl->addMultiCellWidget(slabelButton, 4, 4, 3, 4); |
53 | 53 | ||
54 | gl->addMultiCellWidget(adlabel, 5, 5, 0, 2); | 54 | gl->addMultiCellWidget(adlabel, 5, 5, 0, 2); |
55 | gl->addMultiCellWidget(ad, 5, 5, 3, 4); | 55 | gl->addMultiCellWidget(ad, 5, 5, 3, 4); |
56 | //gl->addWidget(adms, 5, 3); | 56 | //gl->addWidget(adms, 5, 3); |
57 | 57 | ||
58 | gl->addMultiCellWidget(aplabel, 6, 6, 0, 2); | 58 | gl->addMultiCellWidget(aplabel, 6, 6, 0, 2); |
59 | gl->addMultiCellWidget(ap, 6, 6, 3, 4); | 59 | gl->addMultiCellWidget(ap, 6, 6, 3, 4); |
60 | 60 | ||
61 | //gl->addWidget(apms, 6, 3); | 61 | //gl->addWidget(apms, 6, 3); |
62 | 62 | ||
63 | QList<CfgEntry>& e = cfile->getEntries(); | 63 | QList<CfgEntry>& e = cfile->getEntries(); |
64 | 64 | ||
65 | for(uint i = 0; i < e.count(); i++) { | 65 | for(uint i = 0; i < e.count(); i++) { |
66 | CfgEntry* entry = e.at(i); | 66 | CfgEntry* entry = e.at(i); |
67 | keymaps->insertItem(entry->getFile()); | 67 | keymaps->insertItem(entry->getFile()); |
68 | m.insert(entry->getFile(), entry->getLabel()); | 68 | m.insert(entry->getFile(), entry->getLabel()); |
69 | } | 69 | } |
70 | 70 | ||
71 | QDir dir(QPEApplication::qpeDir()+"/share/zkb", "*.xml"); | 71 | QDir dir(QPEApplication::qpeDir()+"share/zkb", "*.xml"); |
72 | QStringList flist = dir.entryList(); | 72 | QStringList flist = dir.entryList(); |
73 | QStringList::Iterator sit; | 73 | QStringList::Iterator sit; |
74 | for(sit = flist.begin(); sit != flist.end(); ++sit) { | 74 | for(sit = flist.begin(); sit != flist.end(); ++sit) { |
75 | if (*sit != "common.xml" && *sit != "zkb.xml" && m.find(*sit) == m.end()) { | 75 | if (*sit != "common.xml" && *sit != "zkb.xml" && m.find(*sit) == m.end()) { |
76 | files->insertItem(*sit); | 76 | files->insertItem(*sit); |
77 | } | 77 | } |
78 | } | 78 | } |
79 | 79 | ||
80 | ad->setValue(cfile->getAutorepeatDelay()); | 80 | ad->setValue(cfile->getAutorepeatDelay()); |
81 | ap->setValue(cfile->getAutorepeatPeriod()); | 81 | ap->setValue(cfile->getAutorepeatPeriod()); |
82 | 82 | ||
83 | //gl->addMultiCellWidget(enable, 7, 7, 0, 4); | 83 | //gl->addMultiCellWidget(enable, 7, 7, 0, 4); |
84 | } | 84 | } |
85 | 85 | ||
86 | CfgDlg::~CfgDlg() { | 86 | CfgDlg::~CfgDlg() { |
87 | } | 87 | } |
88 | 88 | ||
89 | void CfgDlg::add() { | 89 | void CfgDlg::add() { |
90 | if (!files->currentText().isEmpty()) { | 90 | if (!files->currentText().isEmpty()) { |
91 | QString t = files->currentText(); | 91 | QString t = files->currentText(); |
92 | files->removeItem(files->currentItem()); | 92 | files->removeItem(files->currentItem()); |
93 | keymaps->insertItem(t); | 93 | keymaps->insertItem(t); |
94 | cfile->replaceEntry(t, ""); | 94 | cfile->replaceEntry(t, ""); |
95 | m.replace(t, ""); | 95 | m.replace(t, ""); |
96 | } | 96 | } |
97 | } | 97 | } |
98 | 98 | ||
99 | void CfgDlg::del() { | 99 | void CfgDlg::del() { |
100 | if (!keymaps->currentText().isEmpty()) { | 100 | if (!keymaps->currentText().isEmpty()) { |
101 | QString t = keymaps->currentText(); | 101 | QString t = keymaps->currentText(); |
102 | keymaps->removeItem(keymaps->currentItem()); | 102 | keymaps->removeItem(keymaps->currentItem()); |
103 | cfile->deleteEntry(t); | 103 | cfile->deleteEntry(t); |
104 | files->insertItem(t); | 104 | files->insertItem(t); |
105 | m.remove(files->currentText()); | 105 | m.remove(files->currentText()); |
106 | } | 106 | } |
107 | } | 107 | } |
108 | 108 | ||
109 | void CfgDlg::setLabel() { | 109 | void CfgDlg::setLabel() { |
110 | if (!keymaps->currentText().isEmpty()) { | 110 | if (!keymaps->currentText().isEmpty()) { |
111 | cfile->replaceEntry(keymaps->currentText(), | 111 | cfile->replaceEntry(keymaps->currentText(), |
112 | label->text()); | 112 | label->text()); |
113 | m.replace(keymaps->currentText(), label->text()); | 113 | m.replace(keymaps->currentText(), label->text()); |
114 | } | 114 | } |
115 | } | 115 | } |
116 | 116 | ||
117 | void CfgDlg::keymapHighlighted(const QString&text) { | 117 | void CfgDlg::keymapHighlighted(const QString&text) { |
118 | label->setText(*m.find(text)); | 118 | label->setText(*m.find(text)); |
119 | } | 119 | } |
120 | 120 | ||
121 | 121 | ||
122 | void CfgDlg::accept() { | 122 | void CfgDlg::accept() { |
123 | cfile->setAutorepeatDelay(ad->value()); | 123 | cfile->setAutorepeatDelay(ad->value()); |
124 | cfile->setAutorepeatPeriod(ap->value()); | 124 | cfile->setAutorepeatPeriod(ap->value()); |
125 | 125 | ||
126 | CfgParser p; | 126 | CfgParser p; |
127 | p.save(QPEApplication::qpeDir()+"/share/zkb/zkb.xml", *cfile); | 127 | p.save(QPEApplication::qpeDir()+"share/zkb/zkb.xml", *cfile); |
128 | QCopEnvelope("QPE/zkb", "reload()"); | 128 | QCopEnvelope("QPE/zkb", "reload()"); |
129 | 129 | ||
130 | QDialog::accept(); | 130 | QDialog::accept(); |
131 | } | 131 | } |
132 | 132 | ||
diff --git a/noncore/applets/zkbapplet/keyzcfg/main.cpp b/noncore/applets/zkbapplet/keyzcfg/main.cpp index 4615562..afd0f6a 100644 --- a/noncore/applets/zkbapplet/keyzcfg/main.cpp +++ b/noncore/applets/zkbapplet/keyzcfg/main.cpp | |||
@@ -1,22 +1,22 @@ | |||
1 | #include <stdio.h> | 1 | #include <stdio.h> |
2 | #include <qpe/qpeapplication.h> | 2 | #include <qpe/qpeapplication.h> |
3 | #include <qlayout.h> | 3 | #include <qlayout.h> |
4 | #include <qmainwindow.h> | 4 | #include <qmainwindow.h> |
5 | 5 | ||
6 | #include "cfgdlg.h" | 6 | #include "cfgdlg.h" |
7 | 7 | ||
8 | int main( int argc, char **argv ) { | 8 | int main( int argc, char **argv ) { |
9 | QPEApplication app(argc, argv); | 9 | QPEApplication app(argc, argv); |
10 | CfgFile cfile; | 10 | CfgFile cfile; |
11 | CfgParser cp; | 11 | CfgParser cp; |
12 | cp.load(QPEApplication::qpeDir()+"/share/zkb/zkb.xml", cfile); | 12 | cp.load(QPEApplication::qpeDir()+"share/zkb/zkb.xml", cfile); |
13 | 13 | ||
14 | 14 | ||
15 | CfgDlg c(0, &cfile, &app, true); | 15 | CfgDlg c(0, &cfile, &app, true); |
16 | 16 | ||
17 | 17 | ||
18 | app.showMainWidget(&c); | 18 | app.showMainWidget(&c); |
19 | int ret = QPEApplication::execDialog(&c); | 19 | int ret = QPEApplication::execDialog(&c); |
20 | 20 | ||
21 | return ret; | 21 | return ret; |
22 | } | 22 | } |
diff --git a/noncore/apps/opie-bartender/bartender.cpp b/noncore/apps/opie-bartender/bartender.cpp index 59fc242..b4958b3 100644 --- a/noncore/apps/opie-bartender/bartender.cpp +++ b/noncore/apps/opie-bartender/bartender.cpp | |||
@@ -68,97 +68,97 @@ Bartender::Bartender( QWidget* parent, const char* name, WFlags fl ) | |||
68 | fileMenu->insertItem(tr("Open Drink")); | 68 | fileMenu->insertItem(tr("Open Drink")); |
69 | fileMenu->insertItem(tr("Find by Drink Name")); | 69 | fileMenu->insertItem(tr("Find by Drink Name")); |
70 | fileMenu->insertItem(tr("Find by Alcohol")); | 70 | fileMenu->insertItem(tr("Find by Alcohol")); |
71 | 71 | ||
72 | QPopupMenu *editMenu; | 72 | QPopupMenu *editMenu; |
73 | editMenu = new QPopupMenu( this); | 73 | editMenu = new QPopupMenu( this); |
74 | menuBar->insertItem( tr("Edit"), editMenu ); | 74 | menuBar->insertItem( tr("Edit"), editMenu ); |
75 | editMenu->insertItem(tr("edit")); | 75 | editMenu->insertItem(tr("edit")); |
76 | 76 | ||
77 | connect( fileMenu, SIGNAL( activated(int) ), this, SLOT( fileMenuActivated(int) )); | 77 | connect( fileMenu, SIGNAL( activated(int) ), this, SLOT( fileMenuActivated(int) )); |
78 | connect( editMenu, SIGNAL( activated(int) ), this, SLOT( editMenuActivated(int) )); | 78 | connect( editMenu, SIGNAL( activated(int) ), this, SLOT( editMenuActivated(int) )); |
79 | 79 | ||
80 | 80 | ||
81 | QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), "New", 0, this, 0 ); | 81 | QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), "New", 0, this, 0 ); |
82 | connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) ); | 82 | connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) ); |
83 | a->addTo( ToolBar1 ); | 83 | a->addTo( ToolBar1 ); |
84 | 84 | ||
85 | a = new QAction( tr( "Open" ), Resource::loadPixmap( "bartender/bartender_sm" ), "open", 0, this, 0 ); | 85 | a = new QAction( tr( "Open" ), Resource::loadPixmap( "bartender/bartender_sm" ), "open", 0, this, 0 ); |
86 | connect( a, SIGNAL( activated() ), this, SLOT( openCurrentDrink() ) ); | 86 | connect( a, SIGNAL( activated() ), this, SLOT( openCurrentDrink() ) ); |
87 | a->addTo( ToolBar1 ); | 87 | a->addTo( ToolBar1 ); |
88 | 88 | ||
89 | a = new QAction( tr( "Find" ), Resource::loadPixmap( "find" ), "Find", 0, this, 0 ); | 89 | a = new QAction( tr( "Find" ), Resource::loadPixmap( "find" ), "Find", 0, this, 0 ); |
90 | connect( a, SIGNAL( activated() ), this, SLOT( askSearch() ) ); | 90 | connect( a, SIGNAL( activated() ), this, SLOT( askSearch() ) ); |
91 | a->addTo( ToolBar1 ); | 91 | a->addTo( ToolBar1 ); |
92 | 92 | ||
93 | a = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ),"Edit", 0, this, 0 ); | 93 | a = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ),"Edit", 0, this, 0 ); |
94 | connect( a, SIGNAL( activated() ), this, SLOT( doEdit() ) ); | 94 | connect( a, SIGNAL( activated() ), this, SLOT( doEdit() ) ); |
95 | a->addTo( ToolBar1 ); | 95 | a->addTo( ToolBar1 ); |
96 | 96 | ||
97 | QPushButton *t; | 97 | QPushButton *t; |
98 | t= new QPushButton( "BAC", ToolBar1, "bacButtin"); | 98 | t= new QPushButton( "BAC", ToolBar1, "bacButtin"); |
99 | connect( t, SIGNAL( clicked() ), this, SLOT( doBac() ) ); | 99 | connect( t, SIGNAL( clicked() ), this, SLOT( doBac() ) ); |
100 | 100 | ||
101 | DrinkView = new QListView( this, "DrinkView" ); | 101 | DrinkView = new QListView( this, "DrinkView" ); |
102 | DrinkView->addColumn( tr( "Name of Drink" ) ); | 102 | DrinkView->addColumn( tr( "Name of Drink" ) ); |
103 | // DrinkView->setRootIsDecorated( TRUE ); | 103 | // DrinkView->setRootIsDecorated( TRUE ); |
104 | DrinkView->header()->hide(); | 104 | DrinkView->header()->hide(); |
105 | 105 | ||
106 | QPEApplication::setStylusOperation( DrinkView->viewport(),QPEApplication::RightOnHold); | 106 | QPEApplication::setStylusOperation( DrinkView->viewport(),QPEApplication::RightOnHold); |
107 | 107 | ||
108 | connect(DrinkView, SIGNAL( doubleClicked(QListViewItem*)),this,SLOT(showDrink(QListViewItem*))); | 108 | connect(DrinkView, SIGNAL( doubleClicked(QListViewItem*)),this,SLOT(showDrink(QListViewItem*))); |
109 | connect(DrinkView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)), | 109 | connect(DrinkView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)), |
110 | this,SLOT( showDrink(int,QListViewItem*,const QPoint&,int))); | 110 | this,SLOT( showDrink(int,QListViewItem*,const QPoint&,int))); |
111 | 111 | ||
112 | layout->addMultiCellWidget( DrinkView, 1, 2, 0, 4 ); | 112 | layout->addMultiCellWidget( DrinkView, 1, 2, 0, 4 ); |
113 | if(QDir("db").exists()) { | 113 | if(QDir("db").exists()) { |
114 | dbFile.setName( "db/drinkdb.txt"); | 114 | dbFile.setName( "db/drinkdb.txt"); |
115 | } else | 115 | } else |
116 | dbFile.setName( QPEApplication::qpeDir()+"/etc/bartender/drinkdb.txt"); | 116 | dbFile.setName( QPEApplication::qpeDir()+"etc/bartender/drinkdb.txt"); |
117 | initDrinkDb(); | 117 | initDrinkDb(); |
118 | } | 118 | } |
119 | 119 | ||
120 | Bartender::~Bartender() { | 120 | Bartender::~Bartender() { |
121 | } | 121 | } |
122 | 122 | ||
123 | /* | 123 | /* |
124 | this happens right before exit */ | 124 | this happens right before exit */ |
125 | void Bartender::cleanUp() { | 125 | void Bartender::cleanUp() { |
126 | dbFile.close(); | 126 | dbFile.close(); |
127 | 127 | ||
128 | } | 128 | } |
129 | 129 | ||
130 | void Bartender::initDrinkDb() { | 130 | void Bartender::initDrinkDb() { |
131 | 131 | ||
132 | if(!dbFile.isOpen()) | 132 | if(!dbFile.isOpen()) |
133 | if ( !dbFile.open( IO_ReadOnly)) { | 133 | if ( !dbFile.open( IO_ReadOnly)) { |
134 | QMessageBox::message( (tr("Note")), (tr("Drink database not opened sucessfully.\n")) ); | 134 | QMessageBox::message( (tr("Note")), (tr("Drink database not opened sucessfully.\n")) ); |
135 | return; | 135 | return; |
136 | } | 136 | } |
137 | fillList(); | 137 | fillList(); |
138 | } | 138 | } |
139 | 139 | ||
140 | void Bartender::fillList() { | 140 | void Bartender::fillList() { |
141 | dbFile.at(1); | 141 | dbFile.at(1); |
142 | DrinkView->clear(); | 142 | DrinkView->clear(); |
143 | int i=0; | 143 | int i=0; |
144 | QListViewItem * item ; | 144 | QListViewItem * item ; |
145 | QTextStream t( &dbFile); | 145 | QTextStream t( &dbFile); |
146 | QString s; | 146 | QString s; |
147 | while ( !t.eof()) { | 147 | while ( !t.eof()) { |
148 | s = t.readLine(); | 148 | s = t.readLine(); |
149 | if(s.find("#",0,TRUE) != -1) { | 149 | if(s.find("#",0,TRUE) != -1) { |
150 | // odebug << s.right(s.length()-2) << oendl; | 150 | // odebug << s.right(s.length()-2) << oendl; |
151 | item= new QListViewItem( DrinkView, 0 ); | 151 | item= new QListViewItem( DrinkView, 0 ); |
152 | item->setText( 0, s.right(s.length()-2)); | 152 | item->setText( 0, s.right(s.length()-2)); |
153 | i++; | 153 | i++; |
154 | } | 154 | } |
155 | } | 155 | } |
156 | odebug << "there are currently " << i << " of drinks" << oendl; | 156 | odebug << "there are currently " << i << " of drinks" << oendl; |
157 | } | 157 | } |
158 | 158 | ||
159 | void Bartender::fileNew() { | 159 | void Bartender::fileNew() { |
160 | 160 | ||
161 | New_Drink *newDrinks; | 161 | New_Drink *newDrinks; |
162 | newDrinks = new New_Drink(this,"New Drink....", TRUE); | 162 | newDrinks = new New_Drink(this,"New Drink....", TRUE); |
163 | QString newName, newIng; | 163 | QString newName, newIng; |
164 | QPEApplication::execDialog( newDrinks ); | 164 | QPEApplication::execDialog( newDrinks ); |
diff --git a/noncore/apps/opie-console/fixit.cpp b/noncore/apps/opie-console/fixit.cpp index 3b0044a..f170074 100644 --- a/noncore/apps/opie-console/fixit.cpp +++ b/noncore/apps/opie-console/fixit.cpp | |||
@@ -9,86 +9,86 @@ FixIt::FixIt() { | |||
9 | m_file = "#\n# /etc/inittab" | 9 | m_file = "#\n# /etc/inittab" |
10 | "#" | 10 | "#" |
11 | "" | 11 | "" |
12 | "# 0 - halt (Do NOT set initdefault to this)" | 12 | "# 0 - halt (Do NOT set initdefault to this)" |
13 | "# 1 - Single user mode" | 13 | "# 1 - Single user mode" |
14 | "# 2 - Multiuser, without NFS (The same as 3, if you do not have networking)" | 14 | "# 2 - Multiuser, without NFS (The same as 3, if you do not have networking)" |
15 | "# 3 - Full multiuser mode" | 15 | "# 3 - Full multiuser mode" |
16 | "# 4 - JavaVM(Intent) developer mode" | 16 | "# 4 - JavaVM(Intent) developer mode" |
17 | "# 5 - JavaVM(Intent)" | 17 | "# 5 - JavaVM(Intent)" |
18 | "# 6 - reboot (Do NOT set initdefault to this)" | 18 | "# 6 - reboot (Do NOT set initdefault to this)" |
19 | "#" | 19 | "#" |
20 | "id:5:initdefault:" | 20 | "id:5:initdefault:" |
21 | "" | 21 | "" |
22 | "# Specify things to do when starting" | 22 | "# Specify things to do when starting" |
23 | "si::sysinit:/etc/rc.d/rc.sysinit" | 23 | "si::sysinit:/etc/rc.d/rc.sysinit" |
24 | "" | 24 | "" |
25 | "l0:0:wait:/root/etc/rc.d/rc 0" | 25 | "l0:0:wait:/root/etc/rc.d/rc 0" |
26 | "l1:1:wait:/etc/rc.d/rc 1" | 26 | "l1:1:wait:/etc/rc.d/rc 1" |
27 | "l2:2:wait:/etc/rc.d/rc 2" | 27 | "l2:2:wait:/etc/rc.d/rc 2" |
28 | "l3:3:wait:/etc/rc.d/rc 3" | 28 | "l3:3:wait:/etc/rc.d/rc 3" |
29 | "l4:4:wait:/etc/rc.d/rc 4" | 29 | "l4:4:wait:/etc/rc.d/rc 4" |
30 | "l5:5:wait:/etc/rc.d/rc 5" | 30 | "l5:5:wait:/etc/rc.d/rc 5" |
31 | "l6:6:wait:/root/etc/rc.d/rc 6" | 31 | "l6:6:wait:/root/etc/rc.d/rc 6" |
32 | "" | 32 | "" |
33 | "# Specify things to do before rebooting" | 33 | "# Specify things to do before rebooting" |
34 | "um::ctrlaltdel:/bin/umount -a -r > /dev/null 2>&1" | 34 | "um::ctrlaltdel:/bin/umount -a -r > /dev/null 2>&1" |
35 | "sw::ctrlaltdel:/sbin/swapoff -a > /dev/null 2>&1" | 35 | "sw::ctrlaltdel:/sbin/swapoff -a > /dev/null 2>&1" |
36 | "" | 36 | "" |
37 | "# Specify program to run on ttyS0" | 37 | "# Specify program to run on ttyS0" |
38 | "s0:24:respawn:/sbin/getty 9600 ttyS0" | 38 | "s0:24:respawn:/sbin/getty 9600 ttyS0" |
39 | "#pd:5:respawn:/etc/sync/serialctl" | 39 | "#pd:5:respawn:/etc/sync/serialctl" |
40 | "" | 40 | "" |
41 | "# Specify program to run on tty1" | 41 | "# Specify program to run on tty1" |
42 | "1:2:respawn:/sbin/getty 9600 tty1" | 42 | "1:2:respawn:/sbin/getty 9600 tty1" |
43 | "ln:345:respawn:survive -l 6 /sbin/launch" | 43 | "ln:345:respawn:survive -l 6 /sbin/launch" |
44 | "#qt:5:respawn:/sbin/qt" | 44 | "#qt:5:respawn:/sbin/qt" |
45 | "" | 45 | "" |
46 | "# collie sp." | 46 | "# collie sp." |
47 | "sy::respawn:/sbin/shsync\n"; | 47 | "sy::respawn:/sbin/shsync\n"; |
48 | } | 48 | } |
49 | 49 | ||
50 | /* | 50 | /* |
51 | * the retail Zaurus is broken in many ways | 51 | * the retail Zaurus is broken in many ways |
52 | * one is that pppd is listening on our port... | 52 | * one is that pppd is listening on our port... |
53 | * we've to stop it from that and then do kill(SIGHUP,1); | 53 | * we've to stop it from that and then do kill(SIGHUP,1); |
54 | */ | 54 | */ |
55 | void FixIt::fixIt() { | 55 | void FixIt::fixIt() { |
56 | #ifndef EAST | 56 | #ifndef EAST |
57 | ::rename("/etc/inittab", QPEApplication::qpeDir() + "/etc/inittab" ); | 57 | ::rename("/etc/inittab", QPEApplication::qpeDir() + "etc/inittab" ); |
58 | QFile file( "/etc/inittab" ); | 58 | QFile file( "/etc/inittab" ); |
59 | if ( file.open(IO_WriteOnly | IO_Raw ) ) { | 59 | if ( file.open(IO_WriteOnly | IO_Raw ) ) { |
60 | file.writeBlock(m_file,strlen(m_file) ); | 60 | file.writeBlock(m_file,strlen(m_file) ); |
61 | } | 61 | } |
62 | file.close(); | 62 | file.close(); |
63 | ::kill( SIGHUP, 1 ); | 63 | ::kill( SIGHUP, 1 ); |
64 | 64 | ||
65 | #else | 65 | #else |
66 | 66 | ||
67 | OProcess m_kill; | 67 | OProcess m_kill; |
68 | m_kill << QPEApplication::qpeDir() + "/share/opie-console/sl6000_embedix_kill_0_1.sh"; | 68 | m_kill << QPEApplication::qpeDir() + "share/opie-console/sl6000_embedix_kill_0_1.sh"; |
69 | 69 | ||
70 | 70 | ||
71 | if ( !m_kill.start(OProcess::DontCare,OProcess::NoCommunication) ) { | 71 | if ( !m_kill.start(OProcess::DontCare,OProcess::NoCommunication) ) { |
72 | owarn << "could not execute kill script" << oendl; | 72 | owarn << "could not execute kill script" << oendl; |
73 | } else { | 73 | } else { |
74 | Global::statusMessage( QObject::tr("Fixing up Embedix")); | 74 | Global::statusMessage( QObject::tr("Fixing up Embedix")); |
75 | } | 75 | } |
76 | 76 | ||
77 | #endif | 77 | #endif |
78 | } | 78 | } |
79 | 79 | ||
80 | void FixIt::breakIt() { | 80 | void FixIt::breakIt() { |
81 | #ifdef EAST | 81 | #ifdef EAST |
82 | OProcess m_restart; | 82 | OProcess m_restart; |
83 | m_restart << QPEApplication::qpeDir() + "/share/opie-console/sl6000_embedix_restart_0_1.sh"; | 83 | m_restart << QPEApplication::qpeDir() + "share/opie-console/sl6000_embedix_restart_0_1.sh"; |
84 | 84 | ||
85 | 85 | ||
86 | if ( !m_restart.start(OProcess::DontCare,OProcess::NoCommunication) ) { | 86 | if ( !m_restart.start(OProcess::DontCare,OProcess::NoCommunication) ) { |
87 | owarn << "could not execute restart script" << oendl; | 87 | owarn << "could not execute restart script" << oendl; |
88 | } | 88 | } |
89 | 89 | ||
90 | #endif | 90 | #endif |
91 | } | 91 | } |
92 | 92 | ||
93 | 93 | ||
94 | #endif | 94 | #endif |
diff --git a/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp b/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp index 020a116..3c096ed 100644 --- a/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp +++ b/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp | |||
@@ -5,101 +5,101 @@ | |||
5 | // copyright : (C) 2000 - 2004 by llornkcor | 5 | // copyright : (C) 2000 - 2004 by llornkcor |
6 | // email : ljp@llornkcor.com | 6 | // email : ljp@llornkcor.com |
7 | // ***************************************************/ | 7 | // ***************************************************/ |
8 | // /*************************************************************************** | 8 | // /*************************************************************************** |
9 | // * This program is free software; you can redistribute it and/or modify * | 9 | // * This program is free software; you can redistribute it and/or modify * |
10 | // * it under the terms of the GNU General Public License as published by * | 10 | // * it under the terms of the GNU General Public License as published by * |
11 | // * the Free Software Foundation; either version 2 of the License, or * | 11 | // * the Free Software Foundation; either version 2 of the License, or * |
12 | // * (at your option) any later version. * | 12 | // * (at your option) any later version. * |
13 | // ***************************************************************************/ | 13 | // ***************************************************************************/ |
14 | //ftp://ibiblio.org/pub/docs/books/gutenberg/GUTINDEX.ALL | 14 | //ftp://ibiblio.org/pub/docs/books/gutenberg/GUTINDEX.ALL |
15 | 15 | ||
16 | #include "LibraryDialog.h" | 16 | #include "LibraryDialog.h" |
17 | #include "output.h" | 17 | #include "output.h" |
18 | 18 | ||
19 | /* OPIE */ | 19 | /* OPIE */ |
20 | #include <qpe/applnk.h> | 20 | #include <qpe/applnk.h> |
21 | #include <qpe/qpeapplication.h> | 21 | #include <qpe/qpeapplication.h> |
22 | #include <qpe/qpedialog.h> | 22 | #include <qpe/qpedialog.h> |
23 | #include <opie2/odebug.h> | 23 | #include <opie2/odebug.h> |
24 | 24 | ||
25 | /* QT */ | 25 | /* QT */ |
26 | #include <qpushbutton.h> | 26 | #include <qpushbutton.h> |
27 | #include <qmultilineedit.h> | 27 | #include <qmultilineedit.h> |
28 | //#include <qlayout.h> | 28 | //#include <qlayout.h> |
29 | 29 | ||
30 | /* STD */ | 30 | /* STD */ |
31 | #include <unistd.h> | 31 | #include <unistd.h> |
32 | #include <stdio.h> | 32 | #include <stdio.h> |
33 | #include <stdlib.h> | 33 | #include <stdlib.h> |
34 | 34 | ||
35 | /* | 35 | /* |
36 | * The dialog will by default be modeless, unless you set 'modal' to | 36 | * The dialog will by default be modeless, unless you set 'modal' to |
37 | * TRUE to construct a modal dialog. */ | 37 | * TRUE to construct a modal dialog. */ |
38 | LibraryDialog::LibraryDialog( QWidget* parent, const char* name , bool /*modal*/, WFlags fl ) | 38 | LibraryDialog::LibraryDialog( QWidget* parent, const char* name , bool /*modal*/, WFlags fl ) |
39 | : QDialog( parent, name, true/* modal*/, fl ) | 39 | : QDialog( parent, name, true/* modal*/, fl ) |
40 | { | 40 | { |
41 | if ( !name ) | 41 | if ( !name ) |
42 | setName( "LibraryDialog" ); | 42 | setName( "LibraryDialog" ); |
43 | indexLoaded=false; | 43 | indexLoaded=false; |
44 | initDialog(); | 44 | initDialog(); |
45 | 45 | ||
46 | // this->setMaximumWidth(240); | 46 | // this->setMaximumWidth(240); |
47 | 47 | ||
48 | index = "GUTINDEX.ALL"; | 48 | index = "GUTINDEX.ALL"; |
49 | local_library = (QDir::homeDirPath ()) +"/Applications/gutenbrowser/"; | 49 | local_library = (QDir::homeDirPath ()) +"/Applications/gutenbrowser/"; |
50 | local_index = local_library + index; | 50 | local_index = local_library + index; |
51 | 51 | ||
52 | QString iniFile ; | 52 | QString iniFile ; |
53 | iniFile = QPEApplication::qpeDir()+"/etc/gutenbrowser/gutenbrowserrc"; | 53 | iniFile = QPEApplication::qpeDir()+"etc/gutenbrowser/gutenbrowserrc"; |
54 | 54 | ||
55 | new_index =QPEApplication::qpeDir()+"/etc/gutenbrowser/PGWHOLE.TXT"; | 55 | new_index =QPEApplication::qpeDir()+"etc/gutenbrowser/PGWHOLE.TXT"; |
56 | 56 | ||
57 | old_index = QPEApplication::qpeDir()+"/etc/gutenbrowser/GUTINDEX.ALL"; | 57 | old_index = QPEApplication::qpeDir()+"etc/gutenbrowser/GUTINDEX.ALL"; |
58 | // old_index = QPEApplication::qpeDir()+"etc/gutenbrowser/GUTINDEX.ALL"; | 58 | // old_index = QPEApplication::qpeDir()+"etc/gutenbrowser/GUTINDEX.ALL"; |
59 | 59 | ||
60 | // iniFile = local_library+"gutenbrowserrc"; | 60 | // iniFile = local_library+"gutenbrowserrc"; |
61 | // new_index = local_library + "PGWHOLE.TXT"; | 61 | // new_index = local_library + "PGWHOLE.TXT"; |
62 | // old_index = local_library + "GUTINDEX.ALL"; | 62 | // old_index = local_library + "GUTINDEX.ALL"; |
63 | 63 | ||
64 | Config config("Gutenbrowser"); | 64 | Config config("Gutenbrowser"); |
65 | 65 | ||
66 | config.setGroup( "HttpServer" ); | 66 | config.setGroup( "HttpServer" ); |
67 | proxy_http = config.readEntry("Preferred", "http://sailor.gutenbook.org"); | 67 | proxy_http = config.readEntry("Preferred", "http://sailor.gutenbook.org"); |
68 | 68 | ||
69 | config.setGroup( "FTPsite" ); | 69 | config.setGroup( "FTPsite" ); |
70 | ftp_host=config.readEntry("SiteName", "sailor.gutenberg.org"); | 70 | ftp_host=config.readEntry("SiteName", "sailor.gutenberg.org"); |
71 | odebug << "Library Dialog: ftp_host is "+ftp_host << oendl; | 71 | odebug << "Library Dialog: ftp_host is "+ftp_host << oendl; |
72 | // ftp_host=ftp_host.right(ftp_host.length()-(ftp_host.find(") ",0,TRUE)+1) ); | 72 | // ftp_host=ftp_host.right(ftp_host.length()-(ftp_host.find(") ",0,TRUE)+1) ); |
73 | // ftp_host=ftp_host.stripWhiteSpace(); | 73 | // ftp_host=ftp_host.stripWhiteSpace(); |
74 | ftp_base_dir= config.readEntry("base", "/pub/gutenberg"); | 74 | ftp_base_dir= config.readEntry("base", "/pub/gutenberg"); |
75 | 75 | ||
76 | i_binary = 0; | 76 | i_binary = 0; |
77 | 77 | ||
78 | config.setGroup("SortAuth"); | 78 | config.setGroup("SortAuth"); |
79 | if( config.readEntry("authSort", "FALSE") == "TRUE") | 79 | if( config.readEntry("authSort", "FALSE") == "TRUE") |
80 | authBox->setChecked(TRUE); | 80 | authBox->setChecked(TRUE); |
81 | 81 | ||
82 | config.setGroup("General"); | 82 | config.setGroup("General"); |
83 | downDir =config.readEntry( "DownloadDirectory",local_library); | 83 | downDir =config.readEntry( "DownloadDirectory",local_library); |
84 | odebug << "downDir is "+downDir << oendl; | 84 | odebug << "downDir is "+downDir << oendl; |
85 | newindexLib.setName( old_index); | 85 | newindexLib.setName( old_index); |
86 | indexLib.setName( old_index); | 86 | indexLib.setName( old_index); |
87 | 87 | ||
88 | new QPEDialogListener(this); | 88 | new QPEDialogListener(this); |
89 | QTimer::singleShot( 1000, this, SLOT( FindLibrary()) ); | 89 | QTimer::singleShot( 1000, this, SLOT( FindLibrary()) ); |
90 | 90 | ||
91 | } | 91 | } |
92 | 92 | ||
93 | LibraryDialog::~LibraryDialog() | 93 | LibraryDialog::~LibraryDialog() |
94 | { | 94 | { |
95 | // delete QList_Item2; | 95 | // delete QList_Item2; |
96 | // delete QList_Item1; | 96 | // delete QList_Item1; |
97 | // delete QList_Item3; | 97 | // delete QList_Item3; |
98 | // delete QList_Item4; | 98 | // delete QList_Item4; |
99 | // delete QList_Item5; | 99 | // delete QList_Item5; |
100 | 100 | ||
101 | // saveConfig(); | 101 | // saveConfig(); |
102 | } | 102 | } |
103 | 103 | ||
104 | /*This groks using PGWHOLE.TXT */ | 104 | /*This groks using PGWHOLE.TXT */ |
105 | void LibraryDialog::Newlibrary() | 105 | void LibraryDialog::Newlibrary() |
diff --git a/noncore/apps/opie-gutenbrowser/ftpsitedlg.cpp b/noncore/apps/opie-gutenbrowser/ftpsitedlg.cpp index a9c7346..de9c72b 100644 --- a/noncore/apps/opie-gutenbrowser/ftpsitedlg.cpp +++ b/noncore/apps/opie-gutenbrowser/ftpsitedlg.cpp | |||
@@ -1,89 +1,89 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | ftpsitedlg.cpp - description | 2 | ftpsitedlg.cpp - description |
3 | ------------------- | 3 | ------------------- |
4 | begin : Tue Jul 25 2000 | 4 | begin : Tue Jul 25 2000 |
5 | copyright : (C) 2000 -2004 by llornkcor | 5 | copyright : (C) 2000 -2004 by llornkcor |
6 | email : ljp@llornkcor.com | 6 | email : ljp@llornkcor.com |
7 | ***************************************************************************/ | 7 | ***************************************************************************/ |
8 | /*************************************************************************** | 8 | /*************************************************************************** |
9 | * This program is free software; you can redistribute it and/or modify * | 9 | * This program is free software; you can redistribute it and/or modify * |
10 | * it under the terms of the GNU General Public License as published by * | 10 | * it under the terms of the GNU General Public License as published by * |
11 | * the Free Software Foundation; either version 2 of the License, or * | 11 | * the Free Software Foundation; either version 2 of the License, or * |
12 | * (at your option) any later version. * | 12 | * (at your option) any later version. * |
13 | ***************************************************************************/ | 13 | ***************************************************************************/ |
14 | 14 | ||
15 | #include "optionsDialog.h" | 15 | #include "optionsDialog.h" |
16 | #include "gutenbrowser.h" | 16 | #include "gutenbrowser.h" |
17 | //#include "NetworkDialog.h" | 17 | //#include "NetworkDialog.h" |
18 | #include "output.h" | 18 | #include "output.h" |
19 | 19 | ||
20 | /* OPIE */ | 20 | /* OPIE */ |
21 | #include <opie2/odebug.h> | 21 | #include <opie2/odebug.h> |
22 | #include <qpe/config.h> | 22 | #include <qpe/config.h> |
23 | 23 | ||
24 | /* QT */ | 24 | /* QT */ |
25 | #include <qprogressbar.h> | 25 | #include <qprogressbar.h> |
26 | #include <qurloperator.h> | 26 | #include <qurloperator.h> |
27 | #include <qlistbox.h> | 27 | #include <qlistbox.h> |
28 | 28 | ||
29 | /* STD */ | 29 | /* STD */ |
30 | #include <stdlib.h> | 30 | #include <stdlib.h> |
31 | #include <unistd.h> | 31 | #include <unistd.h> |
32 | #include <stdio.h> | 32 | #include <stdio.h> |
33 | 33 | ||
34 | // :)~ | 34 | // :)~ |
35 | void optionsDialog::ftpSiteDlg( ) | 35 | void optionsDialog::ftpSiteDlg( ) |
36 | { | 36 | { |
37 | //printf( "ftpSiteDlg: ListFile is "+ ListFile +"\n" ); | 37 | //printf( "ftpSiteDlg: ListFile is "+ ListFile +"\n" ); |
38 | // initDialog(); | 38 | // initDialog(); |
39 | local_library = (QDir::homeDirPath ()) +"/Applications/gutenbrowser/"; | 39 | local_library = (QDir::homeDirPath ()) +"/Applications/gutenbrowser/"; |
40 | // ListFile = local_library + "ftpList"; | 40 | // ListFile = local_library + "ftpList"; |
41 | ListFile = QPEApplication::qpeDir() + "/etc/gutenbrowser"; | 41 | ListFile = QPEApplication::qpeDir() + "etc/gutenbrowser"; |
42 | QDir dir(ListFile); | 42 | QDir dir(ListFile); |
43 | if( !dir.exists()) | 43 | if( !dir.exists()) |
44 | dir.mkdir(ListFile,true); | 44 | dir.mkdir(ListFile,true); |
45 | ListFile+="/ftpList"; | 45 | ListFile+="/ftpList"; |
46 | odebug << "opening "+ListFile << oendl; | 46 | odebug << "opening "+ListFile << oendl; |
47 | if ( QFile(ListFile).exists() ) { | 47 | if ( QFile(ListFile).exists() ) { |
48 | openSiteList(); | 48 | openSiteList(); |
49 | } else { | 49 | } else { |
50 | switch( QMessageBox::warning( this, "Gutenbrowser", | 50 | switch( QMessageBox::warning( this, "Gutenbrowser", |
51 | "Do you want to download \nan ftp site list?", | 51 | "Do you want to download \nan ftp site list?", |
52 | QMessageBox::Yes, QMessageBox::No)) { | 52 | QMessageBox::Yes, QMessageBox::No)) { |
53 | case QMessageBox::Yes: // yes | 53 | case QMessageBox::Yes: // yes |
54 | getSite(); | 54 | getSite(); |
55 | break; | 55 | break; |
56 | case QMessageBox::No: // No | 56 | case QMessageBox::No: // No |
57 | // exit | 57 | // exit |
58 | break; | 58 | break; |
59 | } | 59 | } |
60 | 60 | ||
61 | } | 61 | } |
62 | } | 62 | } |
63 | 63 | ||
64 | 64 | ||
65 | /* | 65 | /* |
66 | // get ftp list from web- parse it. */ | 66 | // get ftp list from web- parse it. */ |
67 | void optionsDialog::getSite() | 67 | void optionsDialog::getSite() |
68 | { | 68 | { |
69 | QString file_name; | 69 | QString file_name; |
70 | QString ftp_listFileURL; | 70 | QString ftp_listFileURL; |
71 | QString outputFile; | 71 | QString outputFile; |
72 | // outputFile = local_library+ "list.html"; | 72 | // outputFile = local_library+ "list.html"; |
73 | outputFile = ListFile + "list.html"; | 73 | outputFile = ListFile + "list.html"; |
74 | QString networkUrl= "http://www.gutenberg.org/www/mirror.sites.html"; | 74 | QString networkUrl= "http://www.gutenberg.org/www/mirror.sites.html"; |
75 | //http://www.gutenberg.org/index.html"; | 75 | //http://www.gutenberg.org/index.html"; |
76 | // QString networkUrl= "http://llornkcor.com/index.shtml"; | 76 | // QString networkUrl= "http://llornkcor.com/index.shtml"; |
77 | // // "http://www.gutenberg.org/index.html" | 77 | // // "http://www.gutenberg.org/index.html" |
78 | // | 78 | // |
79 | //Qhttp stops working at times.... :( | 79 | //Qhttp stops working at times.... :( |
80 | // NetworkDialog *NetworkDlg; | 80 | // NetworkDialog *NetworkDlg; |
81 | // NetworkDlg = new NetworkDialog( this,"Network Protocol Dialog",TRUE,0,networkUrl,outputFile); | 81 | // NetworkDlg = new NetworkDialog( this,"Network Protocol Dialog",TRUE,0,networkUrl,outputFile); |
82 | // if( NetworkDlg->exec() != 0 ) | 82 | // if( NetworkDlg->exec() != 0 ) |
83 | // { // use new, improved, *INSTANT* network-dialog-file-getterer | 83 | // { // use new, improved, *INSTANT* network-dialog-file-getterer |
84 | // odebug << "gitcha!" << oendl; | 84 | // odebug << "gitcha!" << oendl; |
85 | // } | 85 | // } |
86 | // delete NetworkDlg; | 86 | // delete NetworkDlg; |
87 | //#ifdef Q_WS_QWS | 87 | //#ifdef Q_WS_QWS |
88 | 88 | ||
89 | // TODO qprocess here | 89 | // TODO qprocess here |
diff --git a/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp b/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp index 644fae8..fac21da 100644 --- a/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp +++ b/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp | |||
@@ -97,102 +97,102 @@ Gutenbrowser::Gutenbrowser(QWidget *,const char*, WFlags ) | |||
97 | buttons2 = new QHBoxLayout(-1,"buttons2"); | 97 | buttons2 = new QHBoxLayout(-1,"buttons2"); |
98 | edits = new QHBoxLayout(-1,"edits"); | 98 | edits = new QHBoxLayout(-1,"edits"); |
99 | 99 | ||
100 | useSplitter=TRUE; | 100 | useSplitter=TRUE; |
101 | 101 | ||
102 | initConfig(); | 102 | initConfig(); |
103 | initMenuBar(); | 103 | initMenuBar(); |
104 | initButtonBar(); | 104 | initButtonBar(); |
105 | initStatusBar(); | 105 | initStatusBar(); |
106 | initView(); | 106 | initView(); |
107 | initSlots(); | 107 | initSlots(); |
108 | qDebug("init finished"); | 108 | qDebug("init finished"); |
109 | QPEApplication::setStylusOperation( mainList->viewport(),QPEApplication::RightOnHold); | 109 | QPEApplication::setStylusOperation( mainList->viewport(),QPEApplication::RightOnHold); |
110 | 110 | ||
111 | connect( mainList, SIGNAL( mouseButtonPressed( int, QListBoxItem *, const QPoint &)), | 111 | connect( mainList, SIGNAL( mouseButtonPressed( int, QListBoxItem *, const QPoint &)), |
112 | this, SLOT( mainListPressed(int, QListBoxItem *, const QPoint &)) ); | 112 | this, SLOT( mainListPressed(int, QListBoxItem *, const QPoint &)) ); |
113 | if( useIcons) | 113 | if( useIcons) |
114 | toggleButtonIcons( TRUE); | 114 | toggleButtonIcons( TRUE); |
115 | else | 115 | else |
116 | toggleButtonIcons( FALSE); | 116 | toggleButtonIcons( FALSE); |
117 | 117 | ||
118 | enableButtons(false); | 118 | enableButtons(false); |
119 | 119 | ||
120 | Config config("Gutenbrowser"); // populate menubuttonlist | 120 | Config config("Gutenbrowser"); // populate menubuttonlist |
121 | config.setGroup("General"); | 121 | config.setGroup("General"); |
122 | 122 | ||
123 | config.setGroup( "Files" ); | 123 | config.setGroup( "Files" ); |
124 | QString s_numofFiles = config.readEntry("NumberOfFiles", "0" ); | 124 | QString s_numofFiles = config.readEntry("NumberOfFiles", "0" ); |
125 | int i_numofFiles = s_numofFiles.toInt(); | 125 | int i_numofFiles = s_numofFiles.toInt(); |
126 | 126 | ||
127 | QString tempFileName; | 127 | QString tempFileName; |
128 | 128 | ||
129 | for (int i = 0; i <= i_numofFiles; i++) { | 129 | for (int i = 0; i <= i_numofFiles; i++) { |
130 | // tempFileName.setNum(i); | 130 | // tempFileName.setNum(i); |
131 | config.setGroup( "Files" ); | 131 | config.setGroup( "Files" ); |
132 | QString ramble = config.readEntry( QString::number(i), "" ); | 132 | QString ramble = config.readEntry( QString::number(i), "" ); |
133 | 133 | ||
134 | config.setGroup( "Titles" ); | 134 | config.setGroup( "Titles" ); |
135 | QString tempTitle = config.readEntry( ramble, ""); | 135 | QString tempTitle = config.readEntry( ramble, ""); |
136 | config.setGroup( tempTitle); | 136 | config.setGroup( tempTitle); |
137 | int index = config.readNumEntry( "LineNumber", -1 ); | 137 | int index = config.readNumEntry( "LineNumber", -1 ); |
138 | if( index != -1) { | 138 | if( index != -1) { |
139 | odebug << tempTitle << oendl; | 139 | odebug << tempTitle << oendl; |
140 | if(!tempTitle.isEmpty()) bookmarksMenu->insertItem( tempTitle); | 140 | if(!tempTitle.isEmpty()) bookmarksMenu->insertItem( tempTitle); |
141 | } | 141 | } |
142 | } | 142 | } |
143 | 143 | ||
144 | // QString gutenIndex= local_library + "GUTINDEX.ALL"; | 144 | // QString gutenIndex= local_library + "GUTINDEX.ALL"; |
145 | QString gutenIndex = QPEApplication::qpeDir()+ "/etc/gutenbrowser/GUTINDEX.ALL"; | 145 | QString gutenIndex = QPEApplication::qpeDir()+ "etc/gutenbrowser/GUTINDEX.ALL"; |
146 | qDebug("gutenindex "+gutenIndex ); | 146 | qDebug("gutenindex "+gutenIndex ); |
147 | if( QFile( gutenIndex).exists() ) { | 147 | if( QFile( gutenIndex).exists() ) { |
148 | indexLib.setName( gutenIndex); | 148 | indexLib.setName( gutenIndex); |
149 | } else { | 149 | } else { |
150 | QString localLibIndexFile = QPEApplication::qpeDir()+ "/etc/gutenbrowser/PGWHOLE.TXT"; | 150 | QString localLibIndexFile = QPEApplication::qpeDir()+ "etc/gutenbrowser/PGWHOLE.TXT"; |
151 | // QString localLibIndexFile= local_library + "PGWHOLE.TXT"; | 151 | // QString localLibIndexFile= local_library + "PGWHOLE.TXT"; |
152 | newindexLib.setName( localLibIndexFile); | 152 | newindexLib.setName( localLibIndexFile); |
153 | } | 153 | } |
154 | qDebug("attempting new library"); | 154 | qDebug("attempting new library"); |
155 | LibraryDlg = new LibraryDialog( this, "Library Index" /*, TRUE */); | 155 | LibraryDlg = new LibraryDialog( this, "Library Index" /*, TRUE */); |
156 | loadCheck = false; | 156 | loadCheck = false; |
157 | chdir(local_library); | 157 | chdir(local_library); |
158 | if(!showMainList) { | 158 | if(!showMainList) { |
159 | Lview->setFocus(); | 159 | Lview->setFocus(); |
160 | // if(firstTime) | 160 | // if(firstTime) |
161 | // Bookmark(); | 161 | // Bookmark(); |
162 | for (int i=1;i< qApp->argc();i++) { | 162 | for (int i=1;i< qApp->argc();i++) { |
163 | qDebug("Suppose we open somethin"); | 163 | qDebug("Suppose we open somethin"); |
164 | if(!load(qApp->argv()[i])) return; | 164 | if(!load(qApp->argv()[i])) return; |
165 | } | 165 | } |
166 | } else { | 166 | } else { |
167 | fillWithTitles(); | 167 | fillWithTitles(); |
168 | mainList->setFocus(); | 168 | mainList->setFocus(); |
169 | // mainList->setCurrentItem(0); | 169 | // mainList->setCurrentItem(0); |
170 | 170 | ||
171 | } | 171 | } |
172 | writeConfig(); | 172 | writeConfig(); |
173 | QTimer::singleShot( 250, this, SLOT(hideView()) ); | 173 | QTimer::singleShot( 250, this, SLOT(hideView()) ); |
174 | } //end init | 174 | } //end init |
175 | 175 | ||
176 | Gutenbrowser::~Gutenbrowser() { | 176 | Gutenbrowser::~Gutenbrowser() { |
177 | // QPEApplication::grabKeyboard(); | 177 | // QPEApplication::grabKeyboard(); |
178 | // QPEApplication::ungrabKeyboard(); | 178 | // QPEApplication::ungrabKeyboard(); |
179 | odebug << "Exit" << oendl; | 179 | odebug << "Exit" << oendl; |
180 | } | 180 | } |
181 | 181 | ||
182 | /* | 182 | /* |
183 | Google.com search */ | 183 | Google.com search */ |
184 | void Gutenbrowser::InfoBarClick() { | 184 | void Gutenbrowser::InfoBarClick() { |
185 | QString text; | 185 | QString text; |
186 | if( Lview->hasSelectedText()) { | 186 | if( Lview->hasSelectedText()) { |
187 | Lview->copy(); | 187 | Lview->copy(); |
188 | QClipboard *cb = QApplication::clipboard(); | 188 | QClipboard *cb = QApplication::clipboard(); |
189 | text = cb->text(); | 189 | text = cb->text(); |
190 | } else { | 190 | } else { |
191 | // text=title; | 191 | // text=title; |
192 | text=this->caption(); | 192 | text=this->caption(); |
193 | } | 193 | } |
194 | searchGoogle(text); | 194 | searchGoogle(text); |
195 | } | 195 | } |
196 | 196 | ||
197 | /* | 197 | /* |
198 | download http with wget or preferred browser */ | 198 | download http with wget or preferred browser */ |
diff --git a/noncore/apps/opie-gutenbrowser/helpme.cpp b/noncore/apps/opie-gutenbrowser/helpme.cpp index 53e0236..0e23114 100644 --- a/noncore/apps/opie-gutenbrowser/helpme.cpp +++ b/noncore/apps/opie-gutenbrowser/helpme.cpp | |||
@@ -13,97 +13,97 @@ | |||
13 | * the Free Software Foundation; either version 2 of the License, or * | 13 | * the Free Software Foundation; either version 2 of the License, or * |
14 | * (at your option) any later version. * | 14 | * (at your option) any later version. * |
15 | * * | 15 | * * |
16 | ***************************************************************************/ | 16 | ***************************************************************************/ |
17 | 17 | ||
18 | #include "helpme.h" | 18 | #include "helpme.h" |
19 | #include "helpwindow.h" | 19 | #include "helpwindow.h" |
20 | 20 | ||
21 | /* OPIE */ | 21 | /* OPIE */ |
22 | #include <qpe/qcopenvelope_qws.h> | 22 | #include <qpe/qcopenvelope_qws.h> |
23 | #include <qpe/qpeapplication.h> | 23 | #include <qpe/qpeapplication.h> |
24 | #include <opie2/odebug.h> | 24 | #include <opie2/odebug.h> |
25 | 25 | ||
26 | /* QT */ | 26 | /* QT */ |
27 | #include <qprogressdialog.h> | 27 | #include <qprogressdialog.h> |
28 | #include <qlayout.h> | 28 | #include <qlayout.h> |
29 | 29 | ||
30 | /* STD */ | 30 | /* STD */ |
31 | #include <sys/stat.h> | 31 | #include <sys/stat.h> |
32 | #include <unistd.h> | 32 | #include <unistd.h> |
33 | 33 | ||
34 | HelpMe::HelpMe(QWidget *parent, QString name ) : QDialog(parent,name) | 34 | HelpMe::HelpMe(QWidget *parent, QString name ) : QDialog(parent,name) |
35 | { | 35 | { |
36 | local_library = ( QDir::homeDirPath ())+"/Applications/gutenbrowser/"; | 36 | local_library = ( QDir::homeDirPath ())+"/Applications/gutenbrowser/"; |
37 | setCaption(tr("Gutenbrowser About " VERSION)); | 37 | setCaption(tr("Gutenbrowser About " VERSION)); |
38 | 38 | ||
39 | QGridLayout *layout = new QGridLayout( this ); | 39 | QGridLayout *layout = new QGridLayout( this ); |
40 | layout->setSpacing( 4 ); | 40 | layout->setSpacing( 4 ); |
41 | layout->setMargin( 4 ); | 41 | layout->setMargin( 4 ); |
42 | 42 | ||
43 | Edit = new QMultiLineEdit(this, ""); | 43 | Edit = new QMultiLineEdit(this, ""); |
44 | Edit->setReadOnly(true); | 44 | Edit->setReadOnly(true); |
45 | Edit->append(tr("Based on gutenbook.pl, available from http://www.gutenbook.org")); | 45 | Edit->append(tr("Based on gutenbook.pl, available from http://www.gutenbook.org")); |
46 | Edit->append(tr("Much appreciation to Lee Burgess,")); | 46 | Edit->append(tr("Much appreciation to Lee Burgess,")); |
47 | Edit->append(tr("for the original idea and concept of gutenbook.\n")); | 47 | Edit->append(tr("for the original idea and concept of gutenbook.\n")); |
48 | Edit->append(tr("A list of current Gutenberg ftp sites is at http://promo.net/pg/index.html\n")); | 48 | Edit->append(tr("A list of current Gutenberg ftp sites is at http://promo.net/pg/index.html\n")); |
49 | Edit->append(tr("For bug reports, comments or questions about Gutenbrowser, email")); | 49 | Edit->append(tr("For bug reports, comments or questions about Gutenbrowser, email")); |
50 | Edit->append(tr("ljp@llornkcor.com\n")); | 50 | Edit->append(tr("ljp@llornkcor.com\n")); |
51 | Edit->append(tr("\nMade using Qt, Qt Embedded, and Qtopia, a cross platform development API\nhttp://www.trolltech.com\n\n")); | 51 | Edit->append(tr("\nMade using Qt, Qt Embedded, and Qtopia, a cross platform development API\nhttp://www.trolltech.com\n\n")); |
52 | Edit->append(tr("Arnold's Laws of Documentation:")); | 52 | Edit->append(tr("Arnold's Laws of Documentation:")); |
53 | Edit->append(tr("(1) If it should exist, it doesn't.")); | 53 | Edit->append(tr("(1) If it should exist, it doesn't.")); |
54 | Edit->append(tr("(2) If it does exist, it's out of date.")); | 54 | Edit->append(tr("(2) If it does exist, it's out of date.")); |
55 | Edit->append(tr("(3) Only documentation for")); | 55 | Edit->append(tr("(3) Only documentation for")); |
56 | Edit->append(tr("useless programs transcends the")); | 56 | Edit->append(tr("useless programs transcends the")); |
57 | Edit->append(tr("first two laws.\n")); | 57 | Edit->append(tr("first two laws.\n")); |
58 | Edit->append(tr("Everything is temporary, anyway....\n :o)")); | 58 | Edit->append(tr("Everything is temporary, anyway....\n :o)")); |
59 | Edit->setWordWrap(QMultiLineEdit::WidgetWidth); | 59 | Edit->setWordWrap(QMultiLineEdit::WidgetWidth); |
60 | QString pixDir; | 60 | QString pixDir; |
61 | pixDir=QPEApplication::qpeDir()+"/pics/"; | 61 | pixDir=QPEApplication::qpeDir()+"pics/"; |
62 | QPushButton *help; | 62 | QPushButton *help; |
63 | help = new QPushButton(this); | 63 | help = new QPushButton(this); |
64 | help->setPixmap( QPixmap( pixDir+"gutenbrowser/help.png")); | 64 | help->setPixmap( QPixmap( pixDir+"gutenbrowser/help.png")); |
65 | help->setText("Help"); | 65 | help->setText("Help"); |
66 | connect( help,SIGNAL(clicked()),this,SLOT( help() )); | 66 | connect( help,SIGNAL(clicked()),this,SLOT( help() )); |
67 | 67 | ||
68 | /* QPushButton *ok; | 68 | /* QPushButton *ok; |
69 | ok = new QPushButton(this); | 69 | ok = new QPushButton(this); |
70 | ok->setPixmap( QPixmap( pixDir+"/gutenbrowser/exit.png")); | 70 | ok->setPixmap( QPixmap( pixDir+"/gutenbrowser/exit.png")); |
71 | ok->setText("ok"); | 71 | ok->setText("ok"); |
72 | connect(ok,SIGNAL(clicked()),this,SLOT(accept() )); | 72 | connect(ok,SIGNAL(clicked()),this,SLOT(accept() )); |
73 | */ | 73 | */ |
74 | help->setFixedHeight(25); | 74 | help->setFixedHeight(25); |
75 | // ok->setFixedHeight(25); | 75 | // ok->setFixedHeight(25); |
76 | 76 | ||
77 | // layout->addMultiCellWidget( ok, 0, 0, 4, 4 ); | 77 | // layout->addMultiCellWidget( ok, 0, 0, 4, 4 ); |
78 | layout->addMultiCellWidget( help, 0, 0, 4, 4 ); | 78 | layout->addMultiCellWidget( help, 0, 0, 4, 4 ); |
79 | layout->addMultiCellWidget( Edit, 1, 1, 0, 4 ); | 79 | layout->addMultiCellWidget( Edit, 1, 1, 0, 4 ); |
80 | } | 80 | } |
81 | 81 | ||
82 | HelpMe::~HelpMe() | 82 | HelpMe::~HelpMe() |
83 | { | 83 | { |
84 | //delete Edit; | 84 | //delete Edit; |
85 | 85 | ||
86 | } | 86 | } |
87 | 87 | ||
88 | void HelpMe::goToURL() | 88 | void HelpMe::goToURL() |
89 | { | 89 | { |
90 | 90 | ||
91 | url = "http://www.llornkcor.com/"; | 91 | url = "http://www.llornkcor.com/"; |
92 | goGetit( url); | 92 | goGetit( url); |
93 | } | 93 | } |
94 | 94 | ||
95 | void HelpMe::goToURL2() | 95 | void HelpMe::goToURL2() |
96 | { | 96 | { |
97 | url = "http://www.gutenberg.org"; | 97 | url = "http://www.gutenberg.org"; |
98 | goGetit( url); | 98 | goGetit( url); |
99 | } | 99 | } |
100 | 100 | ||
101 | void HelpMe::goToURL3() | 101 | void HelpMe::goToURL3() |
102 | { | 102 | { |
103 | url = "http://www.gutenbook.org"; | 103 | url = "http://www.gutenbook.org"; |
104 | goGetit( url); | 104 | goGetit( url); |
105 | } | 105 | } |
106 | 106 | ||
107 | void HelpMe::goGetit( QString url) | 107 | void HelpMe::goGetit( QString url) |
108 | { | 108 | { |
109 | HelpWindow *help = new HelpWindow( url, ".", 0, "gutenbrowser"); | 109 | HelpWindow *help = new HelpWindow( url, ".", 0, "gutenbrowser"); |
diff --git a/noncore/apps/zsafe/zsafe.cpp b/noncore/apps/zsafe/zsafe.cpp index 6aa6392..1ae3b15 100644 --- a/noncore/apps/zsafe/zsafe.cpp +++ b/noncore/apps/zsafe/zsafe.cpp | |||
@@ -2731,97 +2731,97 @@ void ZSafe::addCategory() | |||
2731 | QString categ; | 2731 | QString categ; |
2732 | QString firstCategory; | 2732 | QString firstCategory; |
2733 | dialog->CategoryField->clear(); // remove all items | 2733 | dialog->CategoryField->clear(); // remove all items |
2734 | while( it != list.end() ) | 2734 | while( it != list.end() ) |
2735 | { | 2735 | { |
2736 | QString *cat = new QString (*it); | 2736 | QString *cat = new QString (*it); |
2737 | if (cat->contains("-field1", FALSE)) | 2737 | if (cat->contains("-field1", FALSE)) |
2738 | { | 2738 | { |
2739 | #ifdef DESKTOP | 2739 | #ifdef DESKTOP |
2740 | #ifndef Q_WS_WIN | 2740 | #ifndef Q_WS_WIN |
2741 | categ = cat->section ("-field1", 0, 0); | 2741 | categ = cat->section ("-field1", 0, 0); |
2742 | #else | 2742 | #else |
2743 | int pos = cat->find ("-field1"); | 2743 | int pos = cat->find ("-field1"); |
2744 | categ = cat->left (pos); | 2744 | categ = cat->left (pos); |
2745 | #endif | 2745 | #endif |
2746 | #else | 2746 | #else |
2747 | int pos = cat->find ("-field1"); | 2747 | int pos = cat->find ("-field1"); |
2748 | cat->truncate(pos); | 2748 | cat->truncate(pos); |
2749 | categ = *cat; | 2749 | categ = *cat; |
2750 | #endif | 2750 | #endif |
2751 | if (!categ.isEmpty()) | 2751 | if (!categ.isEmpty()) |
2752 | { | 2752 | { |
2753 | dialog->CategoryField->insertItem (categ, -1); | 2753 | dialog->CategoryField->insertItem (categ, -1); |
2754 | if (firstCategory.isEmpty()) | 2754 | if (firstCategory.isEmpty()) |
2755 | firstCategory = categ; | 2755 | firstCategory = categ; |
2756 | } | 2756 | } |
2757 | } | 2757 | } |
2758 | ++it; | 2758 | ++it; |
2759 | } | 2759 | } |
2760 | 2760 | ||
2761 | 2761 | ||
2762 | if (firstCategory.isEmpty()) | 2762 | if (firstCategory.isEmpty()) |
2763 | setCategoryDialogFields(dialog); | 2763 | setCategoryDialogFields(dialog); |
2764 | else | 2764 | else |
2765 | setCategoryDialogFields(dialog, firstCategory); | 2765 | setCategoryDialogFields(dialog, firstCategory); |
2766 | 2766 | ||
2767 | // CategoryDialog *dialog = new CategoryDialog(this, "Category", TRUE); | 2767 | // CategoryDialog *dialog = new CategoryDialog(this, "Category", TRUE); |
2768 | 2768 | ||
2769 | if (initIcons) | 2769 | if (initIcons) |
2770 | { | 2770 | { |
2771 | Wait waitDialog(this, tr("Wait dialog")); | 2771 | Wait waitDialog(this, tr("Wait dialog")); |
2772 | waitDialog.waitLabel->setText(tr("Gathering icons...")); | 2772 | waitDialog.waitLabel->setText(tr("Gathering icons...")); |
2773 | waitDialog.show(); | 2773 | waitDialog.show(); |
2774 | qApp->processEvents(); | 2774 | qApp->processEvents(); |
2775 | 2775 | ||
2776 | #ifdef DESKTOP | 2776 | #ifdef DESKTOP |
2777 | QDir d(iconPath); | 2777 | QDir d(iconPath); |
2778 | #else | 2778 | #else |
2779 | QDir d(QPEApplication::qpeDir() + "/pics/"); | 2779 | QDir d(QPEApplication::qpeDir() + "pics/"); |
2780 | #endif | 2780 | #endif |
2781 | d.setFilter( QDir::Files); | 2781 | d.setFilter( QDir::Files); |
2782 | 2782 | ||
2783 | const QFileInfoList *list = d.entryInfoList(); | 2783 | const QFileInfoList *list = d.entryInfoList(); |
2784 | QFileInfoListIterator it( *list ); // create list iterator | 2784 | QFileInfoListIterator it( *list ); // create list iterator |
2785 | QFileInfo *fi; // pointer for traversing | 2785 | QFileInfo *fi; // pointer for traversing |
2786 | 2786 | ||
2787 | dialog->IconField->insertItem("predefined"); | 2787 | dialog->IconField->insertItem("predefined"); |
2788 | while ( (fi=it.current()) ) { // for each file... | 2788 | while ( (fi=it.current()) ) { // for each file... |
2789 | QString fileName = fi->fileName(); | 2789 | QString fileName = fi->fileName(); |
2790 | if(fileName.right(4) == ".png"){ | 2790 | if(fileName.right(4) == ".png"){ |
2791 | fileName = fileName.mid(0,fileName.length()-4); | 2791 | fileName = fileName.mid(0,fileName.length()-4); |
2792 | #ifdef DESKTOP | 2792 | #ifdef DESKTOP |
2793 | QPixmap imageOfFile; | 2793 | QPixmap imageOfFile; |
2794 | imageOfFile.load(iconPath + fi->fileName()); | 2794 | imageOfFile.load(iconPath + fi->fileName()); |
2795 | #else | 2795 | #else |
2796 | QPixmap imageOfFile(Resource::loadPixmap(fileName)); | 2796 | QPixmap imageOfFile(Resource::loadPixmap(fileName)); |
2797 | #endif | 2797 | #endif |
2798 | QImage foo = imageOfFile.convertToImage(); | 2798 | QImage foo = imageOfFile.convertToImage(); |
2799 | foo = foo.smoothScale(16,16); | 2799 | foo = foo.smoothScale(16,16); |
2800 | imageOfFile.convertFromImage(foo); | 2800 | imageOfFile.convertFromImage(foo); |
2801 | dialog->IconField->insertItem(imageOfFile,fileName); | 2801 | dialog->IconField->insertItem(imageOfFile,fileName); |
2802 | } | 2802 | } |
2803 | ++it; | 2803 | ++it; |
2804 | } | 2804 | } |
2805 | waitDialog.hide(); | 2805 | waitDialog.hide(); |
2806 | } | 2806 | } |
2807 | 2807 | ||
2808 | #ifndef Q_WS_WIN | 2808 | #ifndef Q_WS_WIN |
2809 | dialog->show(); | 2809 | dialog->show(); |
2810 | #endif | 2810 | #endif |
2811 | #ifndef DESKTOP | 2811 | #ifndef DESKTOP |
2812 | // dialog->move (20, 100); | 2812 | // dialog->move (20, 100); |
2813 | #endif | 2813 | #endif |
2814 | DialogCode result = (DialogCode) dialog->exec(); | 2814 | DialogCode result = (DialogCode) dialog->exec(); |
2815 | #ifdef DESKTOP | 2815 | #ifdef DESKTOP |
2816 | result = Accepted; | 2816 | result = Accepted; |
2817 | #endif | 2817 | #endif |
2818 | 2818 | ||
2819 | QString category; | 2819 | QString category; |
2820 | QString icon; | 2820 | QString icon; |
2821 | QString fullIconPath; | 2821 | QString fullIconPath; |
2822 | QPixmap *pix; | 2822 | QPixmap *pix; |
2823 | if (result == Accepted) | 2823 | if (result == Accepted) |
2824 | { | 2824 | { |
2825 | modified = true; | 2825 | modified = true; |
2826 | category = dialog->CategoryField->currentText(); | 2826 | category = dialog->CategoryField->currentText(); |
2827 | icon = dialog->IconField->currentText()+".png"; | 2827 | icon = dialog->IconField->currentText()+".png"; |
@@ -2915,154 +2915,154 @@ void ZSafe::delCategory() | |||
2915 | ListView->takeItem(selectedItem); | 2915 | ListView->takeItem(selectedItem); |
2916 | delete selectedItem; | 2916 | delete selectedItem; |
2917 | 2917 | ||
2918 | selectedItem = NULL; | 2918 | selectedItem = NULL; |
2919 | break; | 2919 | break; |
2920 | case 1: // Don't delete | 2920 | case 1: // Don't delete |
2921 | break; | 2921 | break; |
2922 | } | 2922 | } |
2923 | 2923 | ||
2924 | } | 2924 | } |
2925 | } | 2925 | } |
2926 | 2926 | ||
2927 | void ZSafe::setCategoryDialogFields(CategoryDialog *dialog) | 2927 | void ZSafe::setCategoryDialogFields(CategoryDialog *dialog) |
2928 | { | 2928 | { |
2929 | if (!dialog) | 2929 | if (!dialog) |
2930 | return; | 2930 | return; |
2931 | 2931 | ||
2932 | QString icon; | 2932 | QString icon; |
2933 | if (selectedItem) | 2933 | if (selectedItem) |
2934 | { | 2934 | { |
2935 | dialog->Field1->setText(getFieldLabel (selectedItem, "1", tr("Name"))); | 2935 | dialog->Field1->setText(getFieldLabel (selectedItem, "1", tr("Name"))); |
2936 | dialog->Field2->setText(getFieldLabel (selectedItem, "2", tr("Username"))); | 2936 | dialog->Field2->setText(getFieldLabel (selectedItem, "2", tr("Username"))); |
2937 | dialog->Field3->setText(getFieldLabel (selectedItem, "3", tr("Password"))); | 2937 | dialog->Field3->setText(getFieldLabel (selectedItem, "3", tr("Password"))); |
2938 | dialog->Field4->setText(getFieldLabel (selectedItem, "4", tr("Comment"))); | 2938 | dialog->Field4->setText(getFieldLabel (selectedItem, "4", tr("Comment"))); |
2939 | dialog->Field5->setText(getFieldLabel (selectedItem, "5", tr("Field 4"))); | 2939 | dialog->Field5->setText(getFieldLabel (selectedItem, "5", tr("Field 4"))); |
2940 | dialog->Field6->setText(getFieldLabel (selectedItem, "6", tr("Field 5"))); | 2940 | dialog->Field6->setText(getFieldLabel (selectedItem, "6", tr("Field 5"))); |
2941 | 2941 | ||
2942 | Category *cat= categories.find (selectedItem->text(0)); | 2942 | Category *cat= categories.find (selectedItem->text(0)); |
2943 | if (cat) | 2943 | if (cat) |
2944 | { | 2944 | { |
2945 | icon = cat->getIconName(); | 2945 | icon = cat->getIconName(); |
2946 | } | 2946 | } |
2947 | else | 2947 | else |
2948 | icon = conf->readEntry(APP_KEY+selectedItem->text(0)); | 2948 | icon = conf->readEntry(APP_KEY+selectedItem->text(0)); |
2949 | } | 2949 | } |
2950 | else | 2950 | else |
2951 | { | 2951 | { |
2952 | dialog->Field1->setText(tr("Name")); | 2952 | dialog->Field1->setText(tr("Name")); |
2953 | dialog->Field2->setText(tr("Username")); | 2953 | dialog->Field2->setText(tr("Username")); |
2954 | dialog->Field3->setText(tr("Password")); | 2954 | dialog->Field3->setText(tr("Password")); |
2955 | dialog->Field4->setText(tr("Comment")); | 2955 | dialog->Field4->setText(tr("Comment")); |
2956 | dialog->Field5->setText(tr("Field 4")); | 2956 | dialog->Field5->setText(tr("Field 4")); |
2957 | dialog->Field6->setText(tr("Field 5")); | 2957 | dialog->Field6->setText(tr("Field 5")); |
2958 | } | 2958 | } |
2959 | 2959 | ||
2960 | #ifdef DESKTOP | 2960 | #ifdef DESKTOP |
2961 | QDir d(iconPath); | 2961 | QDir d(iconPath); |
2962 | #else | 2962 | #else |
2963 | QDir d(QPEApplication::qpeDir() + "/pics/"); | 2963 | QDir d(QPEApplication::qpeDir() + "pics/"); |
2964 | #endif | 2964 | #endif |
2965 | d.setFilter( QDir::Files); | 2965 | d.setFilter( QDir::Files); |
2966 | 2966 | ||
2967 | const QFileInfoList *list = d.entryInfoList(); | 2967 | const QFileInfoList *list = d.entryInfoList(); |
2968 | int i=0; | 2968 | int i=0; |
2969 | QFileInfoListIterator it( *list ); // create list iterator | 2969 | QFileInfoListIterator it( *list ); // create list iterator |
2970 | QFileInfo *fi; // pointer for traversing | 2970 | QFileInfo *fi; // pointer for traversing |
2971 | if (icon.isEmpty() || icon.isNull()) | 2971 | if (icon.isEmpty() || icon.isNull()) |
2972 | { | 2972 | { |
2973 | dialog->IconField->setCurrentItem(0); | 2973 | dialog->IconField->setCurrentItem(0); |
2974 | } | 2974 | } |
2975 | else | 2975 | else |
2976 | { | 2976 | { |
2977 | while ( (fi=it.current()) ) | 2977 | while ( (fi=it.current()) ) |
2978 | { // for each file... | 2978 | { // for each file... |
2979 | QString fileName = fi->fileName(); | 2979 | QString fileName = fi->fileName(); |
2980 | if(fileName.right(4) == ".png") | 2980 | if(fileName.right(4) == ".png") |
2981 | { | 2981 | { |
2982 | fileName = fileName.mid(0,fileName.length()-4); | 2982 | fileName = fileName.mid(0,fileName.length()-4); |
2983 | 2983 | ||
2984 | if(fileName+".png"==icon) | 2984 | if(fileName+".png"==icon) |
2985 | { | 2985 | { |
2986 | dialog->IconField->setCurrentItem(i+1); | 2986 | dialog->IconField->setCurrentItem(i+1); |
2987 | break; | 2987 | break; |
2988 | } | 2988 | } |
2989 | ++i; | 2989 | ++i; |
2990 | } | 2990 | } |
2991 | ++it; | 2991 | ++it; |
2992 | } | 2992 | } |
2993 | } | 2993 | } |
2994 | } | 2994 | } |
2995 | 2995 | ||
2996 | void ZSafe::setCategoryDialogFields(CategoryDialog *dialog, QString category) | 2996 | void ZSafe::setCategoryDialogFields(CategoryDialog *dialog, QString category) |
2997 | { | 2997 | { |
2998 | if (!dialog) | 2998 | if (!dialog) |
2999 | return; | 2999 | return; |
3000 | 3000 | ||
3001 | dialog->Field1->setText(getFieldLabel (category, "1", tr("Name"))); | 3001 | dialog->Field1->setText(getFieldLabel (category, "1", tr("Name"))); |
3002 | dialog->Field2->setText(getFieldLabel (category, "2", tr("Username"))); | 3002 | dialog->Field2->setText(getFieldLabel (category, "2", tr("Username"))); |
3003 | dialog->Field3->setText(getFieldLabel (category, "3", tr("Password"))); | 3003 | dialog->Field3->setText(getFieldLabel (category, "3", tr("Password"))); |
3004 | dialog->Field4->setText(getFieldLabel (category, "4", tr("Comment"))); | 3004 | dialog->Field4->setText(getFieldLabel (category, "4", tr("Comment"))); |
3005 | dialog->Field5->setText(getFieldLabel (category, "5", tr("Field 4"))); | 3005 | dialog->Field5->setText(getFieldLabel (category, "5", tr("Field 4"))); |
3006 | dialog->Field6->setText(getFieldLabel (category, "6", tr("Field 5"))); | 3006 | dialog->Field6->setText(getFieldLabel (category, "6", tr("Field 5"))); |
3007 | 3007 | ||
3008 | QString icon; | 3008 | QString icon; |
3009 | Category *cat= categories.find (category); | 3009 | Category *cat= categories.find (category); |
3010 | if (cat) | 3010 | if (cat) |
3011 | { | 3011 | { |
3012 | icon = cat->getIconName(); | 3012 | icon = cat->getIconName(); |
3013 | } | 3013 | } |
3014 | else | 3014 | else |
3015 | icon = conf->readEntry(APP_KEY+category); | 3015 | icon = conf->readEntry(APP_KEY+category); |
3016 | 3016 | ||
3017 | #ifdef DESKTOP | 3017 | #ifdef DESKTOP |
3018 | QDir d(iconPath); | 3018 | QDir d(iconPath); |
3019 | #else | 3019 | #else |
3020 | QDir d(QPEApplication::qpeDir() + "/pics/"); | 3020 | QDir d(QPEApplication::qpeDir() + "pics/"); |
3021 | #endif | 3021 | #endif |
3022 | d.setFilter( QDir::Files); | 3022 | d.setFilter( QDir::Files); |
3023 | 3023 | ||
3024 | const QFileInfoList *list = d.entryInfoList(); | 3024 | const QFileInfoList *list = d.entryInfoList(); |
3025 | int i=0; | 3025 | int i=0; |
3026 | QFileInfoListIterator it( *list ); // create list iterator | 3026 | QFileInfoListIterator it( *list ); // create list iterator |
3027 | QFileInfo *fi; // pointer for traversing | 3027 | QFileInfo *fi; // pointer for traversing |
3028 | if (icon.isEmpty() || icon.isNull()) | 3028 | if (icon.isEmpty() || icon.isNull()) |
3029 | { | 3029 | { |
3030 | dialog->IconField->setCurrentItem(0); | 3030 | dialog->IconField->setCurrentItem(0); |
3031 | } | 3031 | } |
3032 | else | 3032 | else |
3033 | { | 3033 | { |
3034 | while ( (fi=it.current()) ) | 3034 | while ( (fi=it.current()) ) |
3035 | { // for each file... | 3035 | { // for each file... |
3036 | QString fileName = fi->fileName(); | 3036 | QString fileName = fi->fileName(); |
3037 | if(fileName.right(4) == ".png") | 3037 | if(fileName.right(4) == ".png") |
3038 | { | 3038 | { |
3039 | fileName = fileName.mid(0,fileName.length()-4); | 3039 | fileName = fileName.mid(0,fileName.length()-4); |
3040 | 3040 | ||
3041 | if(fileName+".png"==icon) | 3041 | if(fileName+".png"==icon) |
3042 | { | 3042 | { |
3043 | dialog->IconField->setCurrentItem(i+1); | 3043 | dialog->IconField->setCurrentItem(i+1); |
3044 | break; | 3044 | break; |
3045 | } | 3045 | } |
3046 | ++i; | 3046 | ++i; |
3047 | } | 3047 | } |
3048 | ++it; | 3048 | ++it; |
3049 | } | 3049 | } |
3050 | } | 3050 | } |
3051 | } | 3051 | } |
3052 | 3052 | ||
3053 | void ZSafe::saveCategoryDialogFields(CategoryDialog *dialog) | 3053 | void ZSafe::saveCategoryDialogFields(CategoryDialog *dialog) |
3054 | { | 3054 | { |
3055 | QString app_key = APP_KEY; | 3055 | QString app_key = APP_KEY; |
3056 | #ifndef DESKTOP | 3056 | #ifndef DESKTOP |
3057 | conf->setGroup ("fieldDefs"); | 3057 | conf->setGroup ("fieldDefs"); |
3058 | #else | 3058 | #else |
3059 | #ifndef Q_WS_WIN | 3059 | #ifndef Q_WS_WIN |
3060 | app_key += "/fieldDefs/"; | 3060 | app_key += "/fieldDefs/"; |
3061 | #endif | 3061 | #endif |
3062 | #endif | 3062 | #endif |
3063 | QString category = dialog->CategoryField->currentText(); | 3063 | QString category = dialog->CategoryField->currentText(); |
3064 | // #ifndef Q_WS_WIN | 3064 | // #ifndef Q_WS_WIN |
3065 | conf->writeEntry(app_key+category+"-field1", dialog->Field1->text()); | 3065 | conf->writeEntry(app_key+category+"-field1", dialog->Field1->text()); |
3066 | conf->writeEntry(app_key+category+"-field2", dialog->Field2->text()); | 3066 | conf->writeEntry(app_key+category+"-field2", dialog->Field2->text()); |
3067 | conf->writeEntry(app_key+category+"-field3", dialog->Field3->text()); | 3067 | conf->writeEntry(app_key+category+"-field3", dialog->Field3->text()); |
3068 | conf->writeEntry(app_key+category+"-field4", dialog->Field4->text()); | 3068 | conf->writeEntry(app_key+category+"-field4", dialog->Field4->text()); |
@@ -3151,140 +3151,140 @@ void ZSafe::editCategory() | |||
3151 | #ifndef Q_WS_WIN | 3151 | #ifndef Q_WS_WIN |
3152 | categ = cat->section ("-field1", 0, 0); | 3152 | categ = cat->section ("-field1", 0, 0); |
3153 | #else | 3153 | #else |
3154 | int pos = cat->find ("-field1"); | 3154 | int pos = cat->find ("-field1"); |
3155 | categ = cat->left (pos); | 3155 | categ = cat->left (pos); |
3156 | #endif | 3156 | #endif |
3157 | #else | 3157 | #else |
3158 | int pos = cat->find ("-field1"); | 3158 | int pos = cat->find ("-field1"); |
3159 | cat->truncate(pos); | 3159 | cat->truncate(pos); |
3160 | categ = *cat; | 3160 | categ = *cat; |
3161 | #endif | 3161 | #endif |
3162 | if (!categ.isEmpty()) | 3162 | if (!categ.isEmpty()) |
3163 | { | 3163 | { |
3164 | dialog->CategoryField->insertItem (categ, i); | 3164 | dialog->CategoryField->insertItem (categ, i); |
3165 | if (category.compare(categ) == 0) | 3165 | if (category.compare(categ) == 0) |
3166 | { | 3166 | { |
3167 | dialog->CategoryField->setCurrentItem(i); | 3167 | dialog->CategoryField->setCurrentItem(i); |
3168 | foundCategory = true; | 3168 | foundCategory = true; |
3169 | } | 3169 | } |
3170 | i++; | 3170 | i++; |
3171 | } | 3171 | } |
3172 | } | 3172 | } |
3173 | ++it; | 3173 | ++it; |
3174 | } | 3174 | } |
3175 | if (!foundCategory) | 3175 | if (!foundCategory) |
3176 | { | 3176 | { |
3177 | dialog->CategoryField->insertItem (category, i); | 3177 | dialog->CategoryField->insertItem (category, i); |
3178 | dialog->CategoryField->setCurrentItem(i); | 3178 | dialog->CategoryField->setCurrentItem(i); |
3179 | } | 3179 | } |
3180 | 3180 | ||
3181 | QString icon; | 3181 | QString icon; |
3182 | Category *cat= categories.find (selectedItem->text(0)); | 3182 | Category *cat= categories.find (selectedItem->text(0)); |
3183 | if (cat) | 3183 | if (cat) |
3184 | { | 3184 | { |
3185 | icon = cat->getIconName(); | 3185 | icon = cat->getIconName(); |
3186 | } | 3186 | } |
3187 | 3187 | ||
3188 | if (initIcons) | 3188 | if (initIcons) |
3189 | { | 3189 | { |
3190 | 3190 | ||
3191 | Wait waitDialog(this, tr("Wait dialog")); | 3191 | Wait waitDialog(this, tr("Wait dialog")); |
3192 | waitDialog.waitLabel->setText(tr("Gathering icons...")); | 3192 | waitDialog.waitLabel->setText(tr("Gathering icons...")); |
3193 | waitDialog.show(); | 3193 | waitDialog.show(); |
3194 | qApp->processEvents(); | 3194 | qApp->processEvents(); |
3195 | 3195 | ||
3196 | #ifdef DESKTOP | 3196 | #ifdef DESKTOP |
3197 | QDir d(iconPath); | 3197 | QDir d(iconPath); |
3198 | #else | 3198 | #else |
3199 | QDir d(QPEApplication::qpeDir() + "/pics/"); | 3199 | QDir d(QPEApplication::qpeDir() + "pics/"); |
3200 | #endif | 3200 | #endif |
3201 | d.setFilter( QDir::Files); | 3201 | d.setFilter( QDir::Files); |
3202 | 3202 | ||
3203 | const QFileInfoList *list = d.entryInfoList(); | 3203 | const QFileInfoList *list = d.entryInfoList(); |
3204 | int i=0; | 3204 | int i=0; |
3205 | QFileInfoListIterator it( *list ); // create list iterator | 3205 | QFileInfoListIterator it( *list ); // create list iterator |
3206 | QFileInfo *fi; // pointer for traversing | 3206 | QFileInfo *fi; // pointer for traversing |
3207 | if (icon.isEmpty() || icon.isNull()) | 3207 | if (icon.isEmpty() || icon.isNull()) |
3208 | { | 3208 | { |
3209 | dialog->IconField->setCurrentItem(0); | 3209 | dialog->IconField->setCurrentItem(0); |
3210 | } | 3210 | } |
3211 | 3211 | ||
3212 | dialog->IconField->insertItem("predefined"); | 3212 | dialog->IconField->insertItem("predefined"); |
3213 | while ( (fi=it.current()) ) { // for each file... | 3213 | while ( (fi=it.current()) ) { // for each file... |
3214 | QString fileName = fi->fileName(); | 3214 | QString fileName = fi->fileName(); |
3215 | if(fileName.right(4) == ".png") | 3215 | if(fileName.right(4) == ".png") |
3216 | { | 3216 | { |
3217 | fileName = fileName.mid(0,fileName.length()-4); | 3217 | fileName = fileName.mid(0,fileName.length()-4); |
3218 | #ifdef DESKTOP | 3218 | #ifdef DESKTOP |
3219 | QPixmap imageOfFile; | 3219 | QPixmap imageOfFile; |
3220 | imageOfFile.load(iconPath + fi->fileName()); | 3220 | imageOfFile.load(iconPath + fi->fileName()); |
3221 | #else | 3221 | #else |
3222 | QPixmap imageOfFile(Resource::loadPixmap(fileName)); | 3222 | QPixmap imageOfFile(Resource::loadPixmap(fileName)); |
3223 | #endif | 3223 | #endif |
3224 | QImage foo = imageOfFile.convertToImage(); | 3224 | QImage foo = imageOfFile.convertToImage(); |
3225 | foo = foo.smoothScale(16,16); | 3225 | foo = foo.smoothScale(16,16); |
3226 | imageOfFile.convertFromImage(foo); | 3226 | imageOfFile.convertFromImage(foo); |
3227 | dialog->IconField->insertItem(imageOfFile,fileName); | 3227 | dialog->IconField->insertItem(imageOfFile,fileName); |
3228 | if(fileName+".png"==icon) | 3228 | if(fileName+".png"==icon) |
3229 | dialog->IconField->setCurrentItem(i+1); | 3229 | dialog->IconField->setCurrentItem(i+1); |
3230 | ++i; | 3230 | ++i; |
3231 | } | 3231 | } |
3232 | ++it; | 3232 | ++it; |
3233 | } | 3233 | } |
3234 | waitDialog.hide(); | 3234 | waitDialog.hide(); |
3235 | } | 3235 | } |
3236 | else | 3236 | else |
3237 | { | 3237 | { |
3238 | #ifdef DESKTOP | 3238 | #ifdef DESKTOP |
3239 | // QDir d(QDir::homeDirPath() + "/pics/"); | 3239 | // QDir d(QDir::homeDirPath() + "/pics/"); |
3240 | QDir d(iconPath); | 3240 | QDir d(iconPath); |
3241 | #else | 3241 | #else |
3242 | QDir d(QPEApplication::qpeDir() + "/pics/"); | 3242 | QDir d(QPEApplication::qpeDir() + "pics/"); |
3243 | #endif | 3243 | #endif |
3244 | d.setFilter( QDir::Files); | 3244 | d.setFilter( QDir::Files); |
3245 | 3245 | ||
3246 | const QFileInfoList *list = d.entryInfoList(); | 3246 | const QFileInfoList *list = d.entryInfoList(); |
3247 | int i=0; | 3247 | int i=0; |
3248 | QFileInfoListIterator it( *list ); // create list iterator | 3248 | QFileInfoListIterator it( *list ); // create list iterator |
3249 | QFileInfo *fi; // pointer for traversing | 3249 | QFileInfo *fi; // pointer for traversing |
3250 | if (icon.isEmpty() || icon.isNull()) | 3250 | if (icon.isEmpty() || icon.isNull()) |
3251 | { | 3251 | { |
3252 | dialog->IconField->setCurrentItem(0); | 3252 | dialog->IconField->setCurrentItem(0); |
3253 | } | 3253 | } |
3254 | else | 3254 | else |
3255 | { | 3255 | { |
3256 | 3256 | ||
3257 | while ( (fi=it.current()) ) | 3257 | while ( (fi=it.current()) ) |
3258 | { // for each file... | 3258 | { // for each file... |
3259 | QString fileName = fi->fileName(); | 3259 | QString fileName = fi->fileName(); |
3260 | if(fileName.right(4) == ".png") | 3260 | if(fileName.right(4) == ".png") |
3261 | { | 3261 | { |
3262 | fileName = fileName.mid(0,fileName.length()-4); | 3262 | fileName = fileName.mid(0,fileName.length()-4); |
3263 | 3263 | ||
3264 | 3264 | ||
3265 | if(fileName+".png"==icon) | 3265 | if(fileName+".png"==icon) |
3266 | { | 3266 | { |
3267 | dialog->IconField->setCurrentItem(i+1); | 3267 | dialog->IconField->setCurrentItem(i+1); |
3268 | break; | 3268 | break; |
3269 | } | 3269 | } |
3270 | ++i; | 3270 | ++i; |
3271 | } | 3271 | } |
3272 | ++it; | 3272 | ++it; |
3273 | } | 3273 | } |
3274 | } | 3274 | } |
3275 | } | 3275 | } |
3276 | 3276 | ||
3277 | // dialog->show(); | 3277 | // dialog->show(); |
3278 | #ifndef DESKTOP | 3278 | #ifndef DESKTOP |
3279 | // dialog->move (20, 100); | 3279 | // dialog->move (20, 100); |
3280 | #endif | 3280 | #endif |
3281 | DialogCode result = (DialogCode) dialog->exec(); | 3281 | DialogCode result = (DialogCode) dialog->exec(); |
3282 | #ifdef DESKTOP | 3282 | #ifdef DESKTOP |
3283 | result = Accepted; | 3283 | result = Accepted; |
3284 | #endif | 3284 | #endif |
3285 | 3285 | ||
3286 | QString fullIconPath; | 3286 | QString fullIconPath; |
3287 | QPixmap *pix; | 3287 | QPixmap *pix; |
3288 | if (result == Accepted) | 3288 | if (result == Accepted) |
3289 | { | 3289 | { |
3290 | modified = true; | 3290 | modified = true; |
diff --git a/noncore/games/backgammon/backgammon.cpp b/noncore/games/backgammon/backgammon.cpp index bdb1c78..c286a36 100644 --- a/noncore/games/backgammon/backgammon.cpp +++ b/noncore/games/backgammon/backgammon.cpp | |||
@@ -12,97 +12,97 @@ | |||
12 | #include <qpe/resource.h> | 12 | #include <qpe/resource.h> |
13 | using namespace Opie::Core; | 13 | using namespace Opie::Core; |
14 | 14 | ||
15 | /* QT */ | 15 | /* QT */ |
16 | #include <qfile.h> | 16 | #include <qfile.h> |
17 | #include <qlayout.h> | 17 | #include <qlayout.h> |
18 | #include <qmessagebox.h> | 18 | #include <qmessagebox.h> |
19 | #include <qtimer.h> | 19 | #include <qtimer.h> |
20 | #include <qmenubar.h> | 20 | #include <qmenubar.h> |
21 | 21 | ||
22 | #include <stdlib.h> | 22 | #include <stdlib.h> |
23 | 23 | ||
24 | 24 | ||
25 | BackGammon::BackGammon(QWidget* parent, const char* name, WFlags fl) | 25 | BackGammon::BackGammon(QWidget* parent, const char* name, WFlags fl) |
26 | : QMainWindow(parent, name, fl) | 26 | : QMainWindow(parent, name, fl) |
27 | { | 27 | { |
28 | if (!name) setName("BackGammon"); | 28 | if (!name) setName("BackGammon"); |
29 | setCaption(tr( "Backgammon") ); | 29 | setCaption(tr( "Backgammon") ); |
30 | setIcon( Resource::loadPixmap( "backgammon" ) ); | 30 | setIcon( Resource::loadPixmap( "backgammon" ) ); |
31 | //general counter varaible | 31 | //general counter varaible |
32 | int a=0; | 32 | int a=0; |
33 | //the game engine | 33 | //the game engine |
34 | move=new MoveEngine(); | 34 | move=new MoveEngine(); |
35 | 35 | ||
36 | //load the default theme | 36 | //load the default theme |
37 | Config conf("backgammon"); | 37 | Config conf("backgammon"); |
38 | if(!conf.isValid()) | 38 | if(!conf.isValid()) |
39 | { | 39 | { |
40 | odebug << "config file does not exist" << oendl; | 40 | odebug << "config file does not exist" << oendl; |
41 | conf.setGroup("general"); | 41 | conf.setGroup("general"); |
42 | conf.writeEntry("theme","default"); | 42 | conf.writeEntry("theme","default"); |
43 | conf.setGroup("rules"); | 43 | conf.setGroup("rules"); |
44 | conf.writeEntry("move_with_pieces_out",false); | 44 | conf.writeEntry("move_with_pieces_out",false); |
45 | conf.writeEntry("nice_dice",false); | 45 | conf.writeEntry("nice_dice",false); |
46 | conf.setGroup("display"); | 46 | conf.setGroup("display"); |
47 | conf.writeEntry("small",false); | 47 | conf.writeEntry("small",false); |
48 | conf.writeEntry("warning",true); | 48 | conf.writeEntry("warning",true); |
49 | conf.setGroup("ai"); | 49 | conf.setGroup("ai"); |
50 | conf.writeEntry("rescue",6); | 50 | conf.writeEntry("rescue",6); |
51 | conf.writeEntry("eliminate",4); | 51 | conf.writeEntry("eliminate",4); |
52 | conf.writeEntry("expose",1); | 52 | conf.writeEntry("expose",1); |
53 | conf.writeEntry("protect",5); | 53 | conf.writeEntry("protect",5); |
54 | conf.writeEntry("safe",3); | 54 | conf.writeEntry("safe",3); |
55 | conf.writeEntry("empty",2); | 55 | conf.writeEntry("empty",2); |
56 | 56 | ||
57 | } | 57 | } |
58 | conf.setGroup("general"); | 58 | conf.setGroup("general"); |
59 | theme_name=conf.readEntry("theme","default"); | 59 | theme_name=conf.readEntry("theme","default"); |
60 | QString theme_file=QPEApplication::qpeDir()+"/backgammon/"+theme_name+".theme"; | 60 | QString theme_file=QPEApplication::qpeDir()+"backgammon/"+theme_name+".theme"; |
61 | 61 | ||
62 | //the rules | 62 | //the rules |
63 | conf.setGroup("rules"); | 63 | conf.setGroup("rules"); |
64 | rules.move_with_pieces_out=conf.readBoolEntry("move_with_pieces_out",false); | 64 | rules.move_with_pieces_out=conf.readBoolEntry("move_with_pieces_out",false); |
65 | rules.generous_dice=conf.readBoolEntry("nice_dice",false); | 65 | rules.generous_dice=conf.readBoolEntry("nice_dice",false); |
66 | 66 | ||
67 | move->setRules(rules); | 67 | move->setRules(rules); |
68 | 68 | ||
69 | //get the AI settings | 69 | //get the AI settings |
70 | AISettings ai; | 70 | AISettings ai; |
71 | conf.setGroup("ai"); | 71 | conf.setGroup("ai"); |
72 | ai.rescue=conf.readNumEntry("rescue",6); | 72 | ai.rescue=conf.readNumEntry("rescue",6); |
73 | ai.eliminate=conf.readNumEntry("eliminate",4); | 73 | ai.eliminate=conf.readNumEntry("eliminate",4); |
74 | ai.expose=conf.readNumEntry("expose",1); | 74 | ai.expose=conf.readNumEntry("expose",1); |
75 | ai.protect=conf.readNumEntry("protect",5); | 75 | ai.protect=conf.readNumEntry("protect",5); |
76 | ai.safe=conf.readNumEntry("safe",3); | 76 | ai.safe=conf.readNumEntry("safe",3); |
77 | ai.empty=conf.readNumEntry("empty",2); | 77 | ai.empty=conf.readNumEntry("empty",2); |
78 | move->setAISettings(ai); | 78 | move->setAISettings(ai); |
79 | 79 | ||
80 | 80 | ||
81 | //get the theme component names | 81 | //get the theme component names |
82 | Config theme(theme_file,Config::File); | 82 | Config theme(theme_file,Config::File); |
83 | if(!theme.isValid()) | 83 | if(!theme.isValid()) |
84 | { | 84 | { |
85 | odebug << "theme file does not exist" << oendl; | 85 | odebug << "theme file does not exist" << oendl; |
86 | theme.setGroup("theme"); | 86 | theme.setGroup("theme"); |
87 | theme.writeEntry("board","casino_board_1"); | 87 | theme.writeEntry("board","casino_board_1"); |
88 | theme.writeEntry("pieces1","casino_pieces_blue"); | 88 | theme.writeEntry("pieces1","casino_pieces_blue"); |
89 | theme.writeEntry("pieces2","casino_pieces_white"); | 89 | theme.writeEntry("pieces2","casino_pieces_white"); |
90 | theme.writeEntry("dice1","casino_dice"); | 90 | theme.writeEntry("dice1","casino_dice"); |
91 | theme.writeEntry("dice2","casino_dice"); | 91 | theme.writeEntry("dice2","casino_dice"); |
92 | theme.writeEntry("table","casino_table_green"); | 92 | theme.writeEntry("table","casino_table_green"); |
93 | theme.writeEntry("odds","casino_odds"); | 93 | theme.writeEntry("odds","casino_odds"); |
94 | } | 94 | } |
95 | theme.setGroup("theme"); | 95 | theme.setGroup("theme"); |
96 | board_name=theme.readEntry("board","casino_board_1"); | 96 | board_name=theme.readEntry("board","casino_board_1"); |
97 | piecesA_name=theme.readEntry("pieces1","casino_pieces_blue"); | 97 | piecesA_name=theme.readEntry("pieces1","casino_pieces_blue"); |
98 | piecesB_name=theme.readEntry("pieces2","casino_pieces_white"); | 98 | piecesB_name=theme.readEntry("pieces2","casino_pieces_white"); |
99 | diceA_name=theme.readEntry("dice1","casino_dice"); | 99 | diceA_name=theme.readEntry("dice1","casino_dice"); |
100 | diceB_name=theme.readEntry("dice2","casino_dice"); | 100 | diceB_name=theme.readEntry("dice2","casino_dice"); |
101 | table_name=theme.readEntry("table","casino_table_green"); | 101 | table_name=theme.readEntry("table","casino_table_green"); |
102 | odds_name=theme.readEntry("odds","casino_odds"); | 102 | odds_name=theme.readEntry("odds","casino_odds"); |
103 | 103 | ||
104 | 104 | ||
105 | //the menu | 105 | //the menu |
106 | QMenuBar* menuBar = new QMenuBar(this); | 106 | QMenuBar* menuBar = new QMenuBar(this); |
107 | 107 | ||
108 | QPopupMenu* gamemenu= new QPopupMenu(this); | 108 | QPopupMenu* gamemenu= new QPopupMenu(this); |
@@ -283,278 +283,278 @@ BackGammon::~BackGammon() | |||
283 | { | 283 | { |
284 | //DESTRUCTOR | 284 | //DESTRUCTOR |
285 | } | 285 | } |
286 | 286 | ||
287 | void BackGammon::newgame() | 287 | void BackGammon::newgame() |
288 | { | 288 | { |
289 | gameFinished=false; | 289 | gameFinished=false; |
290 | QDateTime now=QDateTime::currentDateTime(); | 290 | QDateTime now=QDateTime::currentDateTime(); |
291 | game_name=now.date().toString()+"_"+now.time().toString(); | 291 | game_name=now.date().toString()+"_"+now.time().toString(); |
292 | move->reset(); | 292 | move->reset(); |
293 | draw(); | 293 | draw(); |
294 | diceA1_value=7; | 294 | diceA1_value=7; |
295 | diceA2_value=7; | 295 | diceA2_value=7; |
296 | diceA3_value=7; | 296 | diceA3_value=7; |
297 | diceA4_value=7; | 297 | diceA4_value=7; |
298 | diceB1_value=7; | 298 | diceB1_value=7; |
299 | diceB2_value=7; | 299 | diceB2_value=7; |
300 | diceB3_value=7; | 300 | diceB3_value=7; |
301 | diceB4_value=7; | 301 | diceB4_value=7; |
302 | showdice(); | 302 | showdice(); |
303 | player=2; | 303 | player=2; |
304 | dice1_played=true; | 304 | dice1_played=true; |
305 | dice2_played=true; | 305 | dice2_played=true; |
306 | dice3_played=true; | 306 | dice3_played=true; |
307 | dice4_played=true; | 307 | dice4_played=true; |
308 | dice_rolled=false; | 308 | dice_rolled=false; |
309 | setplayer(); | 309 | setplayer(); |
310 | area->update(); | 310 | area->update(); |
311 | } | 311 | } |
312 | 312 | ||
313 | void BackGammon::playerselect() | 313 | void BackGammon::playerselect() |
314 | { | 314 | { |
315 | PlayerDialog* playerdialog=new PlayerDialog(this); | 315 | PlayerDialog* playerdialog=new PlayerDialog(this); |
316 | playerdialog->setAuto1(player1_auto); | 316 | playerdialog->setAuto1(player1_auto); |
317 | playerdialog->setAuto2(player2_auto); | 317 | playerdialog->setAuto2(player2_auto); |
318 | if(!playerdialog->exec()) | 318 | if(!playerdialog->exec()) |
319 | return; | 319 | return; |
320 | player1_auto=playerdialog->getAuto1(); | 320 | player1_auto=playerdialog->getAuto1(); |
321 | player2_auto=playerdialog->getAuto2(); | 321 | player2_auto=playerdialog->getAuto2(); |
322 | } | 322 | } |
323 | 323 | ||
324 | void BackGammon::loadgame() | 324 | void BackGammon::loadgame() |
325 | { | 325 | { |
326 | FileDialog* file=new FileDialog(this,"Load Game",".game"); | 326 | FileDialog* file=new FileDialog(this,"Load Game",".game"); |
327 | if(!file->exec()) | 327 | if(!file->exec()) |
328 | return; | 328 | return; |
329 | 329 | ||
330 | game_name=file->filename(); | 330 | game_name=file->filename(); |
331 | QString game_file=QPEApplication::qpeDir()+"/backgammon/"+game_name+".game"; | 331 | QString game_file=QPEApplication::qpeDir()+"backgammon/"+game_name+".game"; |
332 | 332 | ||
333 | Config game(game_file,Config::File); | 333 | Config game(game_file,Config::File); |
334 | game.setGroup("dice"); | 334 | game.setGroup("dice"); |
335 | diceA1_value=game.readNumEntry("diceA1_value"); | 335 | diceA1_value=game.readNumEntry("diceA1_value"); |
336 | diceA2_value=game.readNumEntry("diceA2_value"); | 336 | diceA2_value=game.readNumEntry("diceA2_value"); |
337 | diceA3_value=game.readNumEntry("diceA3_value"); | 337 | diceA3_value=game.readNumEntry("diceA3_value"); |
338 | diceA4_value=game.readNumEntry("diceA4_value"); | 338 | diceA4_value=game.readNumEntry("diceA4_value"); |
339 | diceB1_value=game.readNumEntry("diceB1_value"); | 339 | diceB1_value=game.readNumEntry("diceB1_value"); |
340 | diceB2_value=game.readNumEntry("diceB2_value"); | 340 | diceB2_value=game.readNumEntry("diceB2_value"); |
341 | diceB3_value=game.readNumEntry("diceB3_value"); | 341 | diceB3_value=game.readNumEntry("diceB3_value"); |
342 | diceB4_value=game.readNumEntry("diceB4_value"); | 342 | diceB4_value=game.readNumEntry("diceB4_value"); |
343 | player=game.readNumEntry("player"); | 343 | player=game.readNumEntry("player"); |
344 | dice1_played=game.readBoolEntry("dice1_played"); | 344 | dice1_played=game.readBoolEntry("dice1_played"); |
345 | dice2_played=game.readBoolEntry("dice2_played"); | 345 | dice2_played=game.readBoolEntry("dice2_played"); |
346 | dice3_played=game.readBoolEntry("dice3_played"); | 346 | dice3_played=game.readBoolEntry("dice3_played"); |
347 | dice4_played=game.readBoolEntry("dice4_played"); | 347 | dice4_played=game.readBoolEntry("dice4_played"); |
348 | dice_rolled=game.readBoolEntry("dice_rolled"); | 348 | dice_rolled=game.readBoolEntry("dice_rolled"); |
349 | player1_auto=game.readBoolEntry("player1_auto"); | 349 | player1_auto=game.readBoolEntry("player1_auto"); |
350 | player2_auto=game.readBoolEntry("player2_auto"); | 350 | player2_auto=game.readBoolEntry("player2_auto"); |
351 | 351 | ||
352 | game.setGroup("pieces"); | 352 | game.setGroup("pieces"); |
353 | QString label; | 353 | QString label; |
354 | LoadSave load; | 354 | LoadSave load; |
355 | for(int a=0;a<28;a++) | 355 | for(int a=0;a<28;a++) |
356 | { | 356 | { |
357 | label.setNum(a); | 357 | label.setNum(a); |
358 | load.pop[a].total = game.readNumEntry(label,0); | 358 | load.pop[a].total = game.readNumEntry(label,0); |
359 | } | 359 | } |
360 | 360 | ||
361 | move->loadGame(load); | 361 | move->loadGame(load); |
362 | setplayer(); | 362 | setplayer(); |
363 | showdice(); | 363 | showdice(); |
364 | draw(); | 364 | draw(); |
365 | area->update(); | 365 | area->update(); |
366 | } | 366 | } |
367 | 367 | ||
368 | void BackGammon::savegame() | 368 | void BackGammon::savegame() |
369 | { | 369 | { |
370 | QString game_file=QPEApplication::qpeDir()+"/backgammon/"+game_name+".game"; | 370 | QString game_file=QPEApplication::qpeDir()+"backgammon/"+game_name+".game"; |
371 | 371 | ||
372 | Config game(game_file,Config::File); | 372 | Config game(game_file,Config::File); |
373 | game.setGroup("dice"); | 373 | game.setGroup("dice"); |
374 | game.writeEntry("diceA1_value",diceA1_value); | 374 | game.writeEntry("diceA1_value",diceA1_value); |
375 | game.writeEntry("diceA2_value",diceA2_value); | 375 | game.writeEntry("diceA2_value",diceA2_value); |
376 | game.writeEntry("diceA3_value",diceA3_value); | 376 | game.writeEntry("diceA3_value",diceA3_value); |
377 | game.writeEntry("diceA4_value",diceA4_value); | 377 | game.writeEntry("diceA4_value",diceA4_value); |
378 | game.writeEntry("diceB1_value",diceB1_value); | 378 | game.writeEntry("diceB1_value",diceB1_value); |
379 | game.writeEntry("diceB2_value",diceB3_value); | 379 | game.writeEntry("diceB2_value",diceB3_value); |
380 | game.writeEntry("diceB3_value",diceB4_value); | 380 | game.writeEntry("diceB3_value",diceB4_value); |
381 | game.writeEntry("diceB4_value",diceB4_value); | 381 | game.writeEntry("diceB4_value",diceB4_value); |
382 | game.writeEntry("player",player); | 382 | game.writeEntry("player",player); |
383 | game.writeEntry("dice1_played",dice1_played); | 383 | game.writeEntry("dice1_played",dice1_played); |
384 | game.writeEntry("dice2_played",dice2_played); | 384 | game.writeEntry("dice2_played",dice2_played); |
385 | game.writeEntry("dice3_played",dice3_played); | 385 | game.writeEntry("dice3_played",dice3_played); |
386 | game.writeEntry("dice4_played",dice4_played); | 386 | game.writeEntry("dice4_played",dice4_played); |
387 | game.writeEntry("dice_rolled",dice_rolled); | 387 | game.writeEntry("dice_rolled",dice_rolled); |
388 | game.writeEntry("player1_auto",player1_auto); | 388 | game.writeEntry("player1_auto",player1_auto); |
389 | game.writeEntry("player2_auto",player2_auto); | 389 | game.writeEntry("player2_auto",player2_auto); |
390 | 390 | ||
391 | game.setGroup("pieces"); | 391 | game.setGroup("pieces"); |
392 | QString label; | 392 | QString label; |
393 | LoadSave save=move->saveGame(); | 393 | LoadSave save=move->saveGame(); |
394 | for(int a=0;a<28;a++) | 394 | for(int a=0;a<28;a++) |
395 | { | 395 | { |
396 | label.setNum(a); | 396 | label.setNum(a); |
397 | game.writeEntry(label,save.pop[a].total); | 397 | game.writeEntry(label,save.pop[a].total); |
398 | } | 398 | } |
399 | QMessageBox::information(this,"Backgammon","Game saved","OK"); | 399 | QMessageBox::information(this,"Backgammon","Game saved","OK"); |
400 | } | 400 | } |
401 | 401 | ||
402 | void BackGammon::deletegame() | 402 | void BackGammon::deletegame() |
403 | { | 403 | { |
404 | FileDialog* file=new FileDialog(this,"Delete Game",".game"); | 404 | FileDialog* file=new FileDialog(this,"Delete Game",".game"); |
405 | if(!file->exec()) | 405 | if(!file->exec()) |
406 | return; | 406 | return; |
407 | 407 | ||
408 | game_name=file->filename(); | 408 | game_name=file->filename(); |
409 | QString game_file=QPEApplication::qpeDir()+"/backgammon/"+game_name+".game"; | 409 | QString game_file=QPEApplication::qpeDir()+"backgammon/"+game_name+".game"; |
410 | 410 | ||
411 | if(!QMessageBox::warning(this,"Backgammon","deleted game\n"+game_name+" ?","OK","Cancel")) | 411 | if(!QMessageBox::warning(this,"Backgammon","deleted game\n"+game_name+" ?","OK","Cancel")) |
412 | { | 412 | { |
413 | QFile(game_file).remove(); | 413 | QFile(game_file).remove(); |
414 | } | 414 | } |
415 | } | 415 | } |
416 | 416 | ||
417 | 417 | ||
418 | void BackGammon::newtheme() | 418 | void BackGammon::newtheme() |
419 | { | 419 | { |
420 | ThemeDialog* theme=new ThemeDialog(this); | 420 | ThemeDialog* theme=new ThemeDialog(this); |
421 | 421 | ||
422 | ImageNames names; | 422 | ImageNames names; |
423 | names.theme=theme_name; | 423 | names.theme=theme_name; |
424 | names.board=board_name; | 424 | names.board=board_name; |
425 | names.pieces1=piecesA_name; | 425 | names.pieces1=piecesA_name; |
426 | names.pieces2=piecesB_name; | 426 | names.pieces2=piecesB_name; |
427 | names.dice1=diceA_name; | 427 | names.dice1=diceA_name; |
428 | names.dice2=diceB_name; | 428 | names.dice2=diceB_name; |
429 | names.odds=odds_name; | 429 | names.odds=odds_name; |
430 | names.table=table_name; | 430 | names.table=table_name; |
431 | 431 | ||
432 | theme->setCurrent(names); | 432 | theme->setCurrent(names); |
433 | if(!theme->exec()) | 433 | if(!theme->exec()) |
434 | return; | 434 | return; |
435 | 435 | ||
436 | names=theme->getNames(); | 436 | names=theme->getNames(); |
437 | theme_name=names.theme; | 437 | theme_name=names.theme; |
438 | board_name=names.board; | 438 | board_name=names.board; |
439 | piecesA_name=names.pieces1; | 439 | piecesA_name=names.pieces1; |
440 | piecesB_name=names.pieces2; | 440 | piecesB_name=names.pieces2; |
441 | diceA_name=names.dice1; | 441 | diceA_name=names.dice1; |
442 | diceB_name=names.dice2; | 442 | diceB_name=names.dice2; |
443 | odds_name=names.odds; | 443 | odds_name=names.odds; |
444 | table_name=names.table; | 444 | table_name=names.table; |
445 | 445 | ||
446 | applytheme(); | 446 | applytheme(); |
447 | } | 447 | } |
448 | 448 | ||
449 | void BackGammon::loadtheme() | 449 | void BackGammon::loadtheme() |
450 | { | 450 | { |
451 | FileDialog* file=new FileDialog(this,"Load Theme",".theme"); | 451 | FileDialog* file=new FileDialog(this,"Load Theme",".theme"); |
452 | if(!file->exec()) | 452 | if(!file->exec()) |
453 | return; | 453 | return; |
454 | 454 | ||
455 | theme_name=file->filename(); | 455 | theme_name=file->filename(); |
456 | QString theme_file=QPEApplication::qpeDir()+"/backgammon/"+theme_name+".theme"; | 456 | QString theme_file=QPEApplication::qpeDir()+"backgammon/"+theme_name+".theme"; |
457 | 457 | ||
458 | Config theme(theme_file,Config::File); | 458 | Config theme(theme_file,Config::File); |
459 | theme.setGroup("theme"); | 459 | theme.setGroup("theme"); |
460 | board_name=theme.readEntry("board","board_1"); | 460 | board_name=theme.readEntry("board","board_1"); |
461 | piecesA_name=theme.readEntry("pieces1","pieces_1"); | 461 | piecesA_name=theme.readEntry("pieces1","pieces_1"); |
462 | piecesB_name=theme.readEntry("pieces2","pieces_2"); | 462 | piecesB_name=theme.readEntry("pieces2","pieces_2"); |
463 | diceA_name=theme.readEntry("dice1","dice_1"); | 463 | diceA_name=theme.readEntry("dice1","dice_1"); |
464 | diceB_name=theme.readEntry("dice2","dice_2"); | 464 | diceB_name=theme.readEntry("dice2","dice_2"); |
465 | table_name=theme.readEntry("table","table_1"); | 465 | table_name=theme.readEntry("table","table_1"); |
466 | odds_name=theme.readEntry("odds","odds_1"); | 466 | odds_name=theme.readEntry("odds","odds_1"); |
467 | 467 | ||
468 | applytheme(); | 468 | applytheme(); |
469 | 469 | ||
470 | } | 470 | } |
471 | 471 | ||
472 | void BackGammon::savetheme() | 472 | void BackGammon::savetheme() |
473 | { | 473 | { |
474 | if(theme_name=="default") | 474 | if(theme_name=="default") |
475 | { | 475 | { |
476 | QMessageBox::information(this,"Backgammon","Sorry\nCannot overwrite default.theme","OK"); | 476 | QMessageBox::information(this,"Backgammon","Sorry\nCannot overwrite default.theme","OK"); |
477 | return; | 477 | return; |
478 | } | 478 | } |
479 | QString theme_file=QPEApplication::qpeDir()+"/backgammon/"+theme_name+".theme"; | 479 | QString theme_file=QPEApplication::qpeDir()+"backgammon/"+theme_name+".theme"; |
480 | if(QMessageBox::information(this,"Backgammon","Save Theme\n"+theme_name,"Yes","No")) | 480 | if(QMessageBox::information(this,"Backgammon","Save Theme\n"+theme_name,"Yes","No")) |
481 | return; | 481 | return; |
482 | 482 | ||
483 | Config theme(theme_file,Config::File); | 483 | Config theme(theme_file,Config::File); |
484 | theme.setGroup("theme"); | 484 | theme.setGroup("theme"); |
485 | theme.writeEntry("board",board_name); | 485 | theme.writeEntry("board",board_name); |
486 | theme.writeEntry("pieces1",piecesA_name); | 486 | theme.writeEntry("pieces1",piecesA_name); |
487 | theme.writeEntry("pieces2",piecesB_name); | 487 | theme.writeEntry("pieces2",piecesB_name); |
488 | theme.writeEntry("dice1",diceA_name); | 488 | theme.writeEntry("dice1",diceA_name); |
489 | theme.writeEntry("dice2",diceB_name); | 489 | theme.writeEntry("dice2",diceB_name); |
490 | theme.writeEntry("table",table_name); | 490 | theme.writeEntry("table",table_name); |
491 | theme.writeEntry("odds",odds_name); | 491 | theme.writeEntry("odds",odds_name); |
492 | 492 | ||
493 | } | 493 | } |
494 | 494 | ||
495 | void BackGammon::themedefault() | 495 | void BackGammon::themedefault() |
496 | { | 496 | { |
497 | if(QMessageBox::information(this,"Backgammon","Make Theme\n"+theme_name+"\nthe default theme","Yes","No")) | 497 | if(QMessageBox::information(this,"Backgammon","Make Theme\n"+theme_name+"\nthe default theme","Yes","No")) |
498 | return; | 498 | return; |
499 | 499 | ||
500 | Config conf("backgammon"); | 500 | Config conf("backgammon"); |
501 | conf.setGroup("general"); | 501 | conf.setGroup("general"); |
502 | conf.writeEntry("theme",theme_name); | 502 | conf.writeEntry("theme",theme_name); |
503 | } | 503 | } |
504 | 504 | ||
505 | void BackGammon::deletetheme() | 505 | void BackGammon::deletetheme() |
506 | { | 506 | { |
507 | FileDialog* file=new FileDialog(this,"Delete Theme",".theme"); | 507 | FileDialog* file=new FileDialog(this,"Delete Theme",".theme"); |
508 | if(!file->exec()) | 508 | if(!file->exec()) |
509 | return; | 509 | return; |
510 | 510 | ||
511 | theme_name=file->filename(); | 511 | theme_name=file->filename(); |
512 | QString theme_file=QPEApplication::qpeDir()+"/backgammon/"+theme_name+".theme"; | 512 | QString theme_file=QPEApplication::qpeDir()+"backgammon/"+theme_name+".theme"; |
513 | 513 | ||
514 | if(!QMessageBox::warning(this,tr( "Backgammon" ),tr( "deleted theme %1?").arg(theme_name),tr( "OK" ),tr( "Cancel" ))) | 514 | if(!QMessageBox::warning(this,tr( "Backgammon" ),tr( "deleted theme %1?").arg(theme_name),tr( "OK" ),tr( "Cancel" ))) |
515 | { | 515 | { |
516 | QFile(theme_file).remove(); | 516 | QFile(theme_file).remove(); |
517 | } | 517 | } |
518 | } | 518 | } |
519 | 519 | ||
520 | void BackGammon::modify_AI() | 520 | void BackGammon::modify_AI() |
521 | { | 521 | { |
522 | AI_Dialog* ai_mod=new AI_Dialog(this,tr( "Load Theme" ),".theme"); | 522 | AI_Dialog* ai_mod=new AI_Dialog(this,tr( "Load Theme" ),".theme"); |
523 | ai_mod->setAISettings(move->getAISettings()); | 523 | ai_mod->setAISettings(move->getAISettings()); |
524 | if(!ai_mod->exec()) | 524 | if(!ai_mod->exec()) |
525 | return; | 525 | return; |
526 | 526 | ||
527 | //get the AI settings | 527 | //get the AI settings |
528 | AISettings ai=ai_mod->getAISettings(); | 528 | AISettings ai=ai_mod->getAISettings(); |
529 | move->setAISettings(ai); | 529 | move->setAISettings(ai); |
530 | //write new settings to conf file | 530 | //write new settings to conf file |
531 | Config conf("backgammon"); | 531 | Config conf("backgammon"); |
532 | conf.setGroup("ai"); | 532 | conf.setGroup("ai"); |
533 | conf.writeEntry("rescue",ai.rescue); | 533 | conf.writeEntry("rescue",ai.rescue); |
534 | conf.writeEntry("eliminate",ai.eliminate); | 534 | conf.writeEntry("eliminate",ai.eliminate); |
535 | conf.writeEntry("expose",ai.expose); | 535 | conf.writeEntry("expose",ai.expose); |
536 | conf.writeEntry("protect",ai.protect); | 536 | conf.writeEntry("protect",ai.protect); |
537 | conf.writeEntry("safe",ai.safe); | 537 | conf.writeEntry("safe",ai.safe); |
538 | conf.writeEntry("empty",ai.empty); | 538 | conf.writeEntry("empty",ai.empty); |
539 | } | 539 | } |
540 | 540 | ||
541 | void BackGammon::setrules() | 541 | void BackGammon::setrules() |
542 | { | 542 | { |
543 | RulesDialog* rulesdialog=new RulesDialog(this,tr( "Load Theme" ),".theme"); | 543 | RulesDialog* rulesdialog=new RulesDialog(this,tr( "Load Theme" ),".theme"); |
544 | rulesdialog->setRules(rules); | 544 | rulesdialog->setRules(rules); |
545 | if(!rulesdialog->exec()) | 545 | if(!rulesdialog->exec()) |
546 | return; | 546 | return; |
547 | rules=rulesdialog->getRules(); | 547 | rules=rulesdialog->getRules(); |
548 | Config conf("backgammon"); | 548 | Config conf("backgammon"); |
549 | conf.setGroup("rules"); | 549 | conf.setGroup("rules"); |
550 | conf.writeEntry("move_with_pieces_out",rules.move_with_pieces_out); | 550 | conf.writeEntry("move_with_pieces_out",rules.move_with_pieces_out); |
551 | conf.writeEntry("nice_dice",rules.generous_dice); | 551 | conf.writeEntry("nice_dice",rules.generous_dice); |
552 | move->setRules(rules); | 552 | move->setRules(rules); |
553 | } | 553 | } |
554 | 554 | ||
555 | 555 | ||
556 | void BackGammon::draw() | 556 | void BackGammon::draw() |
557 | { | 557 | { |
558 | Pieces pieces; | 558 | Pieces pieces; |
559 | move->position(pieces); | 559 | move->position(pieces); |
560 | for(int a=0;a<15;a++) | 560 | for(int a=0;a<15;a++) |
diff --git a/noncore/games/backgammon/filedialog.cpp b/noncore/games/backgammon/filedialog.cpp index e0a2914..f185188 100644 --- a/noncore/games/backgammon/filedialog.cpp +++ b/noncore/games/backgammon/filedialog.cpp | |||
@@ -1,61 +1,61 @@ | |||
1 | #include "filedialog.h" | 1 | #include "filedialog.h" |
2 | 2 | ||
3 | #include <qdir.h> | 3 | #include <qdir.h> |
4 | #include <qpe/qpeapplication.h> | 4 | #include <qpe/qpeapplication.h> |
5 | 5 | ||
6 | FileDialog::FileDialog(QWidget* parent,QString header,QString extension,const char* name,bool modal,WFlags f) | 6 | FileDialog::FileDialog(QWidget* parent,QString header,QString extension,const char* name,bool modal,WFlags f) |
7 | :QDialog(parent,name,modal,f) | 7 | :QDialog(parent,name,modal,f) |
8 | { | 8 | { |
9 | setCaption(header); | 9 | setCaption(header); |
10 | ext=extension; | 10 | ext=extension; |
11 | dirselector=new QListView(this); | 11 | dirselector=new QListView(this); |
12 | dirselector->setGeometry(1,10,235,200); | 12 | dirselector->setGeometry(1,10,235,200); |
13 | dirselector->addColumn("Files"); | 13 | dirselector->addColumn("Files"); |
14 | connect(dirselector,SIGNAL(clicked(QListViewItem*)),this,SLOT(selectorclicked(QListViewItem*))); | 14 | connect(dirselector,SIGNAL(clicked(QListViewItem*)),this,SLOT(selectorclicked(QListViewItem*))); |
15 | 15 | ||
16 | getCurrentDir(); | 16 | getCurrentDir(); |
17 | 17 | ||
18 | file_name="user"; | 18 | file_name="user"; |
19 | fileinput=new QLineEdit(file_name,this); | 19 | fileinput=new QLineEdit(file_name,this); |
20 | fileinput->setGeometry(1,220,235,20); | 20 | fileinput->setGeometry(1,220,235,20); |
21 | 21 | ||
22 | QPEApplication::showDialog( this ); | 22 | QPEApplication::showDialog( this ); |
23 | } | 23 | } |
24 | 24 | ||
25 | FileDialog::~FileDialog() | 25 | FileDialog::~FileDialog() |
26 | {} | 26 | {} |
27 | 27 | ||
28 | 28 | ||
29 | void FileDialog::selectorclicked(QListViewItem* entry) | 29 | void FileDialog::selectorclicked(QListViewItem* entry) |
30 | { | 30 | { |
31 | if(entry==NULL) | 31 | if(entry==NULL) |
32 | return; | 32 | return; |
33 | file_name=entry->text(0); | 33 | file_name=entry->text(0); |
34 | fileinput->setText(file_name); | 34 | fileinput->setText(file_name); |
35 | } | 35 | } |
36 | 36 | ||
37 | void FileDialog::getCurrentDir() | 37 | void FileDialog::getCurrentDir() |
38 | { | 38 | { |
39 | dirselector->clear(); | 39 | dirselector->clear(); |
40 | QDir dir(QPEApplication::qpeDir()+"/backgammon"); | 40 | QDir dir(QPEApplication::qpeDir()+"backgammon"); |
41 | dir.setFilter(QDir::Files); | 41 | dir.setFilter(QDir::Files); |
42 | QFileInfoListIterator it(*(dir.entryInfoList())); | 42 | QFileInfoListIterator it(*(dir.entryInfoList())); |
43 | QFileInfo* fi; | 43 | QFileInfo* fi; |
44 | 44 | ||
45 | int ext_length=ext.length(); | 45 | int ext_length=ext.length(); |
46 | while((fi=it.current())) // go through all file and subdirs | 46 | while((fi=it.current())) // go through all file and subdirs |
47 | { | 47 | { |
48 | QString file=fi->fileName(); | 48 | QString file=fi->fileName(); |
49 | if(file.right(ext_length)==ext && file) | 49 | if(file.right(ext_length)==ext && file) |
50 | { | 50 | { |
51 | file=file.left(file.length()-ext_length); | 51 | file=file.left(file.length()-ext_length); |
52 | new QListViewItem(dirselector,file); | 52 | new QListViewItem(dirselector,file); |
53 | } | 53 | } |
54 | ++it; | 54 | ++it; |
55 | } | 55 | } |
56 | } | 56 | } |
57 | 57 | ||
58 | QString FileDialog::filename() | 58 | QString FileDialog::filename() |
59 | { | 59 | { |
60 | return file_name; | 60 | return file_name; |
61 | } | 61 | } |
diff --git a/noncore/games/backgammon/themedialog.cpp b/noncore/games/backgammon/themedialog.cpp index afd6a1b..9bdb6a9 100644 --- a/noncore/games/backgammon/themedialog.cpp +++ b/noncore/games/backgammon/themedialog.cpp | |||
@@ -98,64 +98,64 @@ void ThemeDialog::setCurrent(const ImageNames& current) | |||
98 | break; | 98 | break; |
99 | } | 99 | } |
100 | } | 100 | } |
101 | for(a=0;a<boxpiecesB->count();a++) | 101 | for(a=0;a<boxpiecesB->count();a++) |
102 | { | 102 | { |
103 | if(boxpiecesB->text(a)==current.pieces2) | 103 | if(boxpiecesB->text(a)==current.pieces2) |
104 | { | 104 | { |
105 | boxpiecesB->setCurrentItem(a); | 105 | boxpiecesB->setCurrentItem(a); |
106 | break; | 106 | break; |
107 | } | 107 | } |
108 | } | 108 | } |
109 | for(a=0;a<boxdiceA->count();a++) | 109 | for(a=0;a<boxdiceA->count();a++) |
110 | { | 110 | { |
111 | if(boxdiceA->text(a)==current.dice1) | 111 | if(boxdiceA->text(a)==current.dice1) |
112 | { | 112 | { |
113 | boxdiceA->setCurrentItem(a); | 113 | boxdiceA->setCurrentItem(a); |
114 | break; | 114 | break; |
115 | } | 115 | } |
116 | } | 116 | } |
117 | for(a=0;a<boxdiceB->count();a++) | 117 | for(a=0;a<boxdiceB->count();a++) |
118 | { | 118 | { |
119 | if(boxdiceB->text(a)==current.dice2) | 119 | if(boxdiceB->text(a)==current.dice2) |
120 | { | 120 | { |
121 | boxdiceB->setCurrentItem(a); | 121 | boxdiceB->setCurrentItem(a); |
122 | break; | 122 | break; |
123 | } | 123 | } |
124 | } | 124 | } |
125 | for(a=0;a<boxodds->count();a++) | 125 | for(a=0;a<boxodds->count();a++) |
126 | { | 126 | { |
127 | if(boxodds->text(a)==current.odds) | 127 | if(boxodds->text(a)==current.odds) |
128 | { | 128 | { |
129 | boxodds->setCurrentItem(a); | 129 | boxodds->setCurrentItem(a); |
130 | break; | 130 | break; |
131 | } | 131 | } |
132 | } | 132 | } |
133 | for(a=0;a<boxtable->count();a++) | 133 | for(a=0;a<boxtable->count();a++) |
134 | { | 134 | { |
135 | if(boxtable->text(a)==current.table) | 135 | if(boxtable->text(a)==current.table) |
136 | { | 136 | { |
137 | boxtable->setCurrentItem(a); | 137 | boxtable->setCurrentItem(a); |
138 | break; | 138 | break; |
139 | } | 139 | } |
140 | } | 140 | } |
141 | } | 141 | } |
142 | 142 | ||
143 | void ThemeDialog::fillBox(QString dirname,QComboBox* thebox) | 143 | void ThemeDialog::fillBox(QString dirname,QComboBox* thebox) |
144 | { | 144 | { |
145 | thebox->clear(); | 145 | thebox->clear(); |
146 | QDir dir(QPEApplication::qpeDir()+"/pics/backgammon/"+dirname); | 146 | QDir dir(QPEApplication::qpeDir()+"pics/backgammon/"+dirname); |
147 | dir.setFilter(QDir::Dirs | QDir::Files); | 147 | dir.setFilter(QDir::Dirs | QDir::Files); |
148 | QFileInfoListIterator it(*(dir.entryInfoList())); | 148 | QFileInfoListIterator it(*(dir.entryInfoList())); |
149 | QFileInfo* fi; | 149 | QFileInfo* fi; |
150 | 150 | ||
151 | while((fi=it.current())) // go through all file and subdirs | 151 | while((fi=it.current())) // go through all file and subdirs |
152 | { | 152 | { |
153 | QString file=fi->fileName(); | 153 | QString file=fi->fileName(); |
154 | if(file.right(4)==".png") | 154 | if(file.right(4)==".png") |
155 | { | 155 | { |
156 | thebox->insertItem(file.left(file.find(".png"))); | 156 | thebox->insertItem(file.left(file.find(".png"))); |
157 | } | 157 | } |
158 | ++it; | 158 | ++it; |
159 | } | 159 | } |
160 | delete fi; | 160 | delete fi; |
161 | } | 161 | } |
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index dc2c496..2e9553f 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp | |||
@@ -904,97 +904,97 @@ void PlayListWidget::keyReleaseEvent( QKeyEvent *e ) { | |||
904 | // playSelected(); puh | 904 | // playSelected(); puh |
905 | break; | 905 | break; |
906 | case Key_1: | 906 | case Key_1: |
907 | tabWidget->setCurrentPage( 0 ); | 907 | tabWidget->setCurrentPage( 0 ); |
908 | break; | 908 | break; |
909 | case Key_2: | 909 | case Key_2: |
910 | tabWidget->setCurrentPage( 1 ); | 910 | tabWidget->setCurrentPage( 1 ); |
911 | break; | 911 | break; |
912 | case Key_3: | 912 | case Key_3: |
913 | tabWidget->setCurrentPage( 2 ); | 913 | tabWidget->setCurrentPage( 2 ); |
914 | break; | 914 | break; |
915 | case Key_4: | 915 | case Key_4: |
916 | tabWidget->setCurrentPage( 3 ); | 916 | tabWidget->setCurrentPage( 3 ); |
917 | break; | 917 | break; |
918 | case Key_Down: | 918 | case Key_Down: |
919 | if ( !d->selectedFiles->next() ) | 919 | if ( !d->selectedFiles->next() ) |
920 | d->selectedFiles->first(); | 920 | d->selectedFiles->first(); |
921 | break; | 921 | break; |
922 | case Key_Up: | 922 | case Key_Up: |
923 | if ( !d->selectedFiles->prev() ) | 923 | if ( !d->selectedFiles->prev() ) |
924 | // d->selectedFiles->last(); | 924 | // d->selectedFiles->last(); |
925 | break; | 925 | break; |
926 | } | 926 | } |
927 | } | 927 | } |
928 | 928 | ||
929 | void PlayListWidget::pmViewActivated(int index) { | 929 | void PlayListWidget::pmViewActivated(int index) { |
930 | // odebug << "" << index << "" << oendl; | 930 | // odebug << "" << index << "" << oendl; |
931 | switch(index) { | 931 | switch(index) { |
932 | case -16: | 932 | case -16: |
933 | { | 933 | { |
934 | mediaPlayerState->toggleFullscreen(); | 934 | mediaPlayerState->toggleFullscreen(); |
935 | bool b=mediaPlayerState->isFullscreen(); | 935 | bool b=mediaPlayerState->isFullscreen(); |
936 | pmView->setItemChecked( index, b); | 936 | pmView->setItemChecked( index, b); |
937 | Config cfg( "OpiePlayer" ); | 937 | Config cfg( "OpiePlayer" ); |
938 | cfg.writeEntry( "FullScreen", b ); | 938 | cfg.writeEntry( "FullScreen", b ); |
939 | } | 939 | } |
940 | break; | 940 | break; |
941 | }; | 941 | }; |
942 | } | 942 | } |
943 | 943 | ||
944 | void PlayListWidget::populateSkinsMenu() { | 944 | void PlayListWidget::populateSkinsMenu() { |
945 | int item = 0; | 945 | int item = 0; |
946 | defaultSkinIndex = 0; | 946 | defaultSkinIndex = 0; |
947 | QString skinName; | 947 | QString skinName; |
948 | Config cfg( "OpiePlayer" ); | 948 | Config cfg( "OpiePlayer" ); |
949 | cfg.setGroup("Options" ); | 949 | cfg.setGroup("Options" ); |
950 | QString skin = cfg.readEntry( "Skin", "default" ); | 950 | QString skin = cfg.readEntry( "Skin", "default" ); |
951 | 951 | ||
952 | QDir skinsDir( QPEApplication::qpeDir() + "/pics/opieplayer2/skins" ); | 952 | QDir skinsDir( QPEApplication::qpeDir() + "pics/opieplayer2/skins" ); |
953 | skinsDir.setFilter( QDir::Dirs ); | 953 | skinsDir.setFilter( QDir::Dirs ); |
954 | skinsDir.setSorting(QDir::Name ); | 954 | skinsDir.setSorting(QDir::Name ); |
955 | const QFileInfoList *skinslist = skinsDir.entryInfoList(); | 955 | const QFileInfoList *skinslist = skinsDir.entryInfoList(); |
956 | QFileInfoListIterator it( *skinslist ); | 956 | QFileInfoListIterator it( *skinslist ); |
957 | QFileInfo *fi; | 957 | QFileInfo *fi; |
958 | while ( ( fi = it.current() ) ) { | 958 | while ( ( fi = it.current() ) ) { |
959 | skinName = fi->fileName(); | 959 | skinName = fi->fileName(); |
960 | // odebug << fi->fileName() << oendl; | 960 | // odebug << fi->fileName() << oendl; |
961 | if( skinName != "." && skinName != ".." && skinName !="CVS" ) { | 961 | if( skinName != "." && skinName != ".." && skinName !="CVS" ) { |
962 | item = skinsMenu->insertItem( fi->fileName() ) ; | 962 | item = skinsMenu->insertItem( fi->fileName() ) ; |
963 | } | 963 | } |
964 | if( skinName == "default" ) { | 964 | if( skinName == "default" ) { |
965 | defaultSkinIndex = item; | 965 | defaultSkinIndex = item; |
966 | } | 966 | } |
967 | if( skinName == skin ) { | 967 | if( skinName == skin ) { |
968 | skinsMenu->setItemChecked( item, TRUE ); | 968 | skinsMenu->setItemChecked( item, TRUE ); |
969 | } | 969 | } |
970 | ++it; | 970 | ++it; |
971 | } | 971 | } |
972 | } | 972 | } |
973 | 973 | ||
974 | void PlayListWidget::skinsMenuActivated( int item ) { | 974 | void PlayListWidget::skinsMenuActivated( int item ) { |
975 | for(unsigned int i = defaultSkinIndex; i > defaultSkinIndex - skinsMenu->count(); i-- ) { | 975 | for(unsigned int i = defaultSkinIndex; i > defaultSkinIndex - skinsMenu->count(); i-- ) { |
976 | skinsMenu->setItemChecked( i, FALSE ); | 976 | skinsMenu->setItemChecked( i, FALSE ); |
977 | } | 977 | } |
978 | skinsMenu->setItemChecked( item, TRUE ); | 978 | skinsMenu->setItemChecked( item, TRUE ); |
979 | 979 | ||
980 | { | 980 | { |
981 | Config cfg( "OpiePlayer" ); | 981 | Config cfg( "OpiePlayer" ); |
982 | cfg.setGroup("Options"); | 982 | cfg.setGroup("Options"); |
983 | cfg.writeEntry("Skin", skinsMenu->text( item ) ); | 983 | cfg.writeEntry("Skin", skinsMenu->text( item ) ); |
984 | } | 984 | } |
985 | 985 | ||
986 | emit skinSelected(); | 986 | emit skinSelected(); |
987 | } | 987 | } |
988 | 988 | ||
989 | PlayListWidget::TabType PlayListWidget::currentTab() const | 989 | PlayListWidget::TabType PlayListWidget::currentTab() const |
990 | { | 990 | { |
991 | static const TabType indexToTabType[ TabTypeCount ] = | 991 | static const TabType indexToTabType[ TabTypeCount ] = |
992 | { CurrentPlayList, AudioFiles, VideoFiles, PlayLists }; | 992 | { CurrentPlayList, AudioFiles, VideoFiles, PlayLists }; |
993 | 993 | ||
994 | int index = tabWidget->currentPageIndex(); | 994 | int index = tabWidget->currentPageIndex(); |
995 | assert( index < TabTypeCount && index >= 0 ); | 995 | assert( index < TabTypeCount && index >= 0 ); |
996 | 996 | ||
997 | return indexToTabType[ index ]; | 997 | return indexToTabType[ index ]; |
998 | } | 998 | } |
999 | 999 | ||
1000 | PlayListWidget::Entry PlayListWidget::currentEntry() const | 1000 | PlayListWidget::Entry PlayListWidget::currentEntry() const |
diff --git a/noncore/settings/language/language.cpp b/noncore/settings/language/language.cpp index 81d6717..14750ac 100644 --- a/noncore/settings/language/language.cpp +++ b/noncore/settings/language/language.cpp | |||
@@ -12,97 +12,97 @@ | |||
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include "settings.h" | 21 | #include "settings.h" |
22 | 22 | ||
23 | #include <qpe/global.h> | 23 | #include <qpe/global.h> |
24 | #include <qpe/fontmanager.h> | 24 | #include <qpe/fontmanager.h> |
25 | #include <qpe/config.h> | 25 | #include <qpe/config.h> |
26 | #include <qpe/applnk.h> | 26 | #include <qpe/applnk.h> |
27 | #include <qpe/qpedialog.h> | 27 | #include <qpe/qpedialog.h> |
28 | #include <qpe/qpeapplication.h> | 28 | #include <qpe/qpeapplication.h> |
29 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 29 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
30 | #include <qpe/qcopenvelope_qws.h> | 30 | #include <qpe/qcopenvelope_qws.h> |
31 | #endif | 31 | #endif |
32 | 32 | ||
33 | #include <qlabel.h> | 33 | #include <qlabel.h> |
34 | #include <qcheckbox.h> | 34 | #include <qcheckbox.h> |
35 | #include <qradiobutton.h> | 35 | #include <qradiobutton.h> |
36 | #include <qtabwidget.h> | 36 | #include <qtabwidget.h> |
37 | #include <qslider.h> | 37 | #include <qslider.h> |
38 | #include <qfile.h> | 38 | #include <qfile.h> |
39 | #include <qtextstream.h> | 39 | #include <qtextstream.h> |
40 | #include <qdatastream.h> | 40 | #include <qdatastream.h> |
41 | #include <qmessagebox.h> | 41 | #include <qmessagebox.h> |
42 | #include <qcombobox.h> | 42 | #include <qcombobox.h> |
43 | #include <qspinbox.h> | 43 | #include <qspinbox.h> |
44 | #include <qlistbox.h> | 44 | #include <qlistbox.h> |
45 | #include <qdir.h> | 45 | #include <qdir.h> |
46 | #if QT_VERSION >= 300 | 46 | #if QT_VERSION >= 300 |
47 | #include <qstylefactory.h> | 47 | #include <qstylefactory.h> |
48 | #endif | 48 | #endif |
49 | 49 | ||
50 | #include <stdlib.h> | 50 | #include <stdlib.h> |
51 | 51 | ||
52 | 52 | ||
53 | LanguageSettings::LanguageSettings( QWidget* parent, const char* name, WFlags fl ) | 53 | LanguageSettings::LanguageSettings( QWidget* parent, const char* name, WFlags fl ) |
54 | : LanguageSettingsBase( parent, name, TRUE, fl ) | 54 | : LanguageSettingsBase( parent, name, TRUE, fl ) |
55 | { | 55 | { |
56 | if ( FontManager::hasUnicodeFont() ) | 56 | if ( FontManager::hasUnicodeFont() ) |
57 | languages->setFont(FontManager::unicodeFont(FontManager::Proportional)); | 57 | languages->setFont(FontManager::unicodeFont(FontManager::Proportional)); |
58 | 58 | ||
59 | 59 | ||
60 | QString tfn = QPEApplication::qpeDir() + "/i18n/"; | 60 | QString tfn = QPEApplication::qpeDir() + "i18n/"; |
61 | QDir langDir = tfn; | 61 | QDir langDir = tfn; |
62 | QStringList list = langDir.entryList("*", QDir::Dirs ); | 62 | QStringList list = langDir.entryList("*", QDir::Dirs ); |
63 | 63 | ||
64 | QStringList::Iterator it; | 64 | QStringList::Iterator it; |
65 | 65 | ||
66 | for ( it = list.begin(); it != list.end(); ++it ) { | 66 | for ( it = list.begin(); it != list.end(); ++it ) { |
67 | QString name = (*it); | 67 | QString name = (*it); |
68 | QFileInfo desktopFile( tfn + "/" + name + "/.directory" ); | 68 | QFileInfo desktopFile( tfn + "/" + name + "/.directory" ); |
69 | if ( desktopFile.exists() ) { | 69 | if ( desktopFile.exists() ) { |
70 | langAvail.append(name); | 70 | langAvail.append(name); |
71 | Config conf( desktopFile.filePath(), Config::File ); | 71 | Config conf( desktopFile.filePath(), Config::File ); |
72 | QString langName = conf.readEntry( "Name" ); | 72 | QString langName = conf.readEntry( "Name" ); |
73 | QString ownName = conf.readEntryDirect( "Name[" + name + "]" ); | 73 | QString ownName = conf.readEntryDirect( "Name[" + name + "]" ); |
74 | if ( ownName.isEmpty() ) | 74 | if ( ownName.isEmpty() ) |
75 | ownName = conf.readEntryDirect( "Name" ); | 75 | ownName = conf.readEntryDirect( "Name" ); |
76 | if ( !ownName.isEmpty() && ownName != langName ) | 76 | if ( !ownName.isEmpty() && ownName != langName ) |
77 | langName = langName + " [" + ownName + "]"; | 77 | langName = langName + " [" + ownName + "]"; |
78 | languages->insertItem( langName ); | 78 | languages->insertItem( langName ); |
79 | 79 | ||
80 | } | 80 | } |
81 | } | 81 | } |
82 | if ( langAvail. find ( "en" ) == -1 ) { | 82 | if ( langAvail. find ( "en" ) == -1 ) { |
83 | langAvail. prepend ( "" ); // no tr | 83 | langAvail. prepend ( "" ); // no tr |
84 | languages-> insertItem ( QString ( "English [%1] (%2)" /* no tr (!) */ ). arg ( tr ( "English" )). arg ( tr( "default" )), 0 ); | 84 | languages-> insertItem ( QString ( "English [%1] (%2)" /* no tr (!) */ ). arg ( tr ( "English" )). arg ( tr( "default" )), 0 ); |
85 | } | 85 | } |
86 | 86 | ||
87 | dl = new QPEDialogListener(this); | 87 | dl = new QPEDialogListener(this); |
88 | reset(); | 88 | reset(); |
89 | } | 89 | } |
90 | 90 | ||
91 | LanguageSettings::~LanguageSettings() | 91 | LanguageSettings::~LanguageSettings() |
92 | {} | 92 | {} |
93 | 93 | ||
94 | void LanguageSettings::accept() | 94 | void LanguageSettings::accept() |
95 | { | 95 | { |
96 | Config c( "qpe" ); | 96 | Config c( "qpe" ); |
97 | c.setGroup( "Startup" ); | 97 | c.setGroup( "Startup" ); |
98 | if ( ( c.readNumEntry( "FirstUse", 42 ) == 0 ) && | 98 | if ( ( c.readNumEntry( "FirstUse", 42 ) == 0 ) && |
99 | ( QMessageBox::warning( this, tr("Language"), tr("<qt>Attention, all windows will be closed by changing the language\n" | 99 | ( QMessageBox::warning( this, tr("Language"), tr("<qt>Attention, all windows will be closed by changing the language\n" |
100 | "without saving the Data.<br><br>Go on?</qt>"), 1, 2) ) | 100 | "without saving the Data.<br><br>Go on?</qt>"), 1, 2) ) |
101 | == QMessageBox::Cancel ) | 101 | == QMessageBox::Cancel ) |
102 | return; | 102 | return; |
103 | applyLanguage(); | 103 | applyLanguage(); |
104 | QDialog::accept(); | 104 | QDialog::accept(); |
105 | } | 105 | } |
106 | 106 | ||
107 | void LanguageSettings::applyLanguage() | 107 | void LanguageSettings::applyLanguage() |
108 | { | 108 | { |
diff --git a/noncore/settings/networksettings/mainwindow/mainwindowimp.cpp b/noncore/settings/networksettings/mainwindow/mainwindowimp.cpp index fb7d7c9..5f23aea 100644 --- a/noncore/settings/networksettings/mainwindow/mainwindowimp.cpp +++ b/noncore/settings/networksettings/mainwindow/mainwindowimp.cpp | |||
@@ -243,97 +243,97 @@ void MainWindowImp::getAllInterfaces() | |||
243 | } | 243 | } |
244 | // now lets ask the plugins too ;) | 244 | // now lets ask the plugins too ;) |
245 | QMap<Module*, QLibrary*>::Iterator it; | 245 | QMap<Module*, QLibrary*>::Iterator it; |
246 | QList<Interface> ilist; | 246 | QList<Interface> ilist; |
247 | for( it = libraries.begin(); it != libraries.end(); ++it ) | 247 | for( it = libraries.begin(); it != libraries.end(); ++it ) |
248 | { | 248 | { |
249 | if(it.key()) | 249 | if(it.key()) |
250 | { | 250 | { |
251 | ilist = it.key()->getInterfaces(); | 251 | ilist = it.key()->getInterfaces(); |
252 | for( i = ilist.first(); i != 0; i = ilist.next() ) | 252 | for( i = ilist.first(); i != 0; i = ilist.next() ) |
253 | { | 253 | { |
254 | owarn << "Adding interface " << i->getInterfaceName().latin1() << " to interfaceNames\n" << oendl; | 254 | owarn << "Adding interface " << i->getInterfaceName().latin1() << " to interfaceNames\n" << oendl; |
255 | interfaceNames.insert(i->getInterfaceName(), i); | 255 | interfaceNames.insert(i->getInterfaceName(), i); |
256 | updateInterface(i); | 256 | updateInterface(i); |
257 | connect(i, SIGNAL(updateInterface(Interface*)), | 257 | connect(i, SIGNAL(updateInterface(Interface*)), |
258 | this, SLOT(updateInterface(Interface*))); | 258 | this, SLOT(updateInterface(Interface*))); |
259 | } | 259 | } |
260 | } | 260 | } |
261 | } | 261 | } |
262 | } | 262 | } |
263 | 263 | ||
264 | /** | 264 | /** |
265 | * Load all modules that are found in the path | 265 | * Load all modules that are found in the path |
266 | * @param path a directory that is scaned for any plugins that can be loaded | 266 | * @param path a directory that is scaned for any plugins that can be loaded |
267 | * and attempts to load them | 267 | * and attempts to load them |
268 | */ | 268 | */ |
269 | void MainWindowImp::loadModules(const QString &path) | 269 | void MainWindowImp::loadModules(const QString &path) |
270 | { | 270 | { |
271 | #ifdef DEBUG | 271 | #ifdef DEBUG |
272 | odebug << "MainWindowImp::loadModules: " << path.latin1() << "" << oendl; | 272 | odebug << "MainWindowImp::loadModules: " << path.latin1() << "" << oendl; |
273 | #endif | 273 | #endif |
274 | QDir d(path); | 274 | QDir d(path); |
275 | if(!d.exists()) | 275 | if(!d.exists()) |
276 | return; | 276 | return; |
277 | 277 | ||
278 | QString lang = ::getenv("LANG"); | 278 | QString lang = ::getenv("LANG"); |
279 | // Don't want sym links | 279 | // Don't want sym links |
280 | d.setFilter( QDir::Files | QDir::NoSymLinks ); | 280 | d.setFilter( QDir::Files | QDir::NoSymLinks ); |
281 | const QFileInfoList *list = d.entryInfoList(); | 281 | const QFileInfoList *list = d.entryInfoList(); |
282 | QFileInfoListIterator it( *list ); | 282 | QFileInfoListIterator it( *list ); |
283 | QFileInfo *fi; | 283 | QFileInfo *fi; |
284 | while ( (fi=it.current()) ) | 284 | while ( (fi=it.current()) ) |
285 | { | 285 | { |
286 | if(fi->fileName().contains(".so")) | 286 | if(fi->fileName().contains(".so")) |
287 | { | 287 | { |
288 | /* if loaded install translation */ | 288 | /* if loaded install translation */ |
289 | if( loadPlugin(path + "/" + fi->fileName()) != 0l ){ | 289 | if( loadPlugin(path + "/" + fi->fileName()) != 0l ){ |
290 | QTranslator *trans = new QTranslator(qApp); | 290 | QTranslator *trans = new QTranslator(qApp); |
291 | QString fn = QPEApplication::qpeDir()+"/i18n/"+lang+"/"+ fi->fileName().left( fi->fileName().find(".") )+".qm"; | 291 | QString fn = QPEApplication::qpeDir()+"i18n/"+lang+"/"+ fi->fileName().left( fi->fileName().find(".") )+".qm"; |
292 | if( trans->load( fn ) ) | 292 | if( trans->load( fn ) ) |
293 | qApp->installTranslator( trans ); | 293 | qApp->installTranslator( trans ); |
294 | else | 294 | else |
295 | delete trans; | 295 | delete trans; |
296 | } | 296 | } |
297 | odebug << "loaded plugin: >" << QString(path + "/" + fi->fileName()).latin1() << "< " << oendl; | 297 | odebug << "loaded plugin: >" << QString(path + "/" + fi->fileName()).latin1() << "< " << oendl; |
298 | } | 298 | } |
299 | ++it; | 299 | ++it; |
300 | } | 300 | } |
301 | } | 301 | } |
302 | 302 | ||
303 | /** | 303 | /** |
304 | * Attempt to load a function and resolve a function. | 304 | * Attempt to load a function and resolve a function. |
305 | * @param pluginFileName - the name of the file in which to attempt to load | 305 | * @param pluginFileName - the name of the file in which to attempt to load |
306 | * @param resolveString - function pointer to resolve | 306 | * @param resolveString - function pointer to resolve |
307 | * @return pointer to the function with name resolveString or NULL | 307 | * @return pointer to the function with name resolveString or NULL |
308 | */ | 308 | */ |
309 | Module* MainWindowImp::loadPlugin(const QString &pluginFileName, const QString &resolveString) | 309 | Module* MainWindowImp::loadPlugin(const QString &pluginFileName, const QString &resolveString) |
310 | { | 310 | { |
311 | #ifdef DEBUG | 311 | #ifdef DEBUG |
312 | odebug << "MainWindowImp::loadPlugin: " << pluginFileName.latin1() << ": resolving " << resolveString.latin1() << "" << oendl; | 312 | odebug << "MainWindowImp::loadPlugin: " << pluginFileName.latin1() << ": resolving " << resolveString.latin1() << "" << oendl; |
313 | #endif | 313 | #endif |
314 | QLibrary *lib = new QLibrary(pluginFileName); | 314 | QLibrary *lib = new QLibrary(pluginFileName); |
315 | void *functionPointer = lib->resolve(resolveString); | 315 | void *functionPointer = lib->resolve(resolveString); |
316 | if( !functionPointer ) | 316 | if( !functionPointer ) |
317 | { | 317 | { |
318 | #ifdef DEBUG | 318 | #ifdef DEBUG |
319 | odebug << "MainWindowImp::loadPlugin: Warning: " << pluginFileName.latin1() << " is not a plugin" << oendl; | 319 | odebug << "MainWindowImp::loadPlugin: Warning: " << pluginFileName.latin1() << " is not a plugin" << oendl; |
320 | #endif | 320 | #endif |
321 | delete lib; | 321 | delete lib; |
322 | return 0; | 322 | return 0; |
323 | } | 323 | } |
324 | // Try to get an object. | 324 | // Try to get an object. |
325 | Module *object = ((Module* (*)()) functionPointer)(); | 325 | Module *object = ((Module* (*)()) functionPointer)(); |
326 | if(object == 0) | 326 | if(object == 0) |
327 | { | 327 | { |
328 | #ifdef DEBUG | 328 | #ifdef DEBUG |
329 | odebug << "MainWindowImp: Couldn't create object, but did load library!" << oendl; | 329 | odebug << "MainWindowImp: Couldn't create object, but did load library!" << oendl; |
330 | #endif | 330 | #endif |
331 | delete lib; | 331 | delete lib; |
332 | return 0; | 332 | return 0; |
333 | } | 333 | } |
334 | 334 | ||
335 | m_handledIfaces += object->handledInterfaceNames(); | 335 | m_handledIfaces += object->handledInterfaceNames(); |
336 | // Store for deletion later | 336 | // Store for deletion later |
337 | libraries.insert(object, lib); | 337 | libraries.insert(object, lib); |
338 | return object; | 338 | return object; |
339 | } | 339 | } |
diff --git a/noncore/settings/sysinfo/benchmarkinfo.cpp b/noncore/settings/sysinfo/benchmarkinfo.cpp index 793fcb1..060185a 100644 --- a/noncore/settings/sysinfo/benchmarkinfo.cpp +++ b/noncore/settings/sysinfo/benchmarkinfo.cpp | |||
@@ -97,97 +97,97 @@ BenchmarkInfo::BenchmarkInfo( QWidget *parent, const char *name, int wFlags ) | |||
97 | vb->setMargin( 4 ); | 97 | vb->setMargin( 4 ); |
98 | 98 | ||
99 | tests = new OListView( this ); | 99 | tests = new OListView( this ); |
100 | QWhatsThis::add( tests->viewport(), tr( "This area shows the available tests, the results for which the tests " | 100 | QWhatsThis::add( tests->viewport(), tr( "This area shows the available tests, the results for which the tests " |
101 | "have been performed, and comparison values for one selected device. " | 101 | "have been performed, and comparison values for one selected device. " |
102 | "Use the checkboxes to define which tests you want to perform." ) ); | 102 | "Use the checkboxes to define which tests you want to perform." ) ); |
103 | tests->setMargin( 0 ); | 103 | tests->setMargin( 0 ); |
104 | tests->addColumn( tr( "Tests" ) ); | 104 | tests->addColumn( tr( "Tests" ) ); |
105 | tests->addColumn( tr( "Results" ) ); | 105 | tests->addColumn( tr( "Results" ) ); |
106 | tests->addColumn( tr( "Comparison" ) ); | 106 | tests->addColumn( tr( "Comparison" ) ); |
107 | tests->setShowSortIndicator( true ); | 107 | tests->setShowSortIndicator( true ); |
108 | 108 | ||
109 | test_alu = new OCheckListItem( tests, tr( "1. Integer Arithmetic " ), OCheckListItem::CheckBox ); | 109 | test_alu = new OCheckListItem( tests, tr( "1. Integer Arithmetic " ), OCheckListItem::CheckBox ); |
110 | test_fpu = new OCheckListItem( tests, tr( "2. Floating Point Unit " ), OCheckListItem::CheckBox ); | 110 | test_fpu = new OCheckListItem( tests, tr( "2. Floating Point Unit " ), OCheckListItem::CheckBox ); |
111 | test_txt = new OCheckListItem( tests, tr( "3. Text Rendering " ), OCheckListItem::CheckBox ); | 111 | test_txt = new OCheckListItem( tests, tr( "3. Text Rendering " ), OCheckListItem::CheckBox ); |
112 | test_gfx = new OCheckListItem( tests, tr( "4. Gfx Rendering " ), OCheckListItem::CheckBox ); | 112 | test_gfx = new OCheckListItem( tests, tr( "4. Gfx Rendering " ), OCheckListItem::CheckBox ); |
113 | test_ram = new OCheckListItem( tests, tr( "5. RAM Performance " ), OCheckListItem::CheckBox ); | 113 | test_ram = new OCheckListItem( tests, tr( "5. RAM Performance " ), OCheckListItem::CheckBox ); |
114 | #ifndef QT_QWS_RAMSES | 114 | #ifndef QT_QWS_RAMSES |
115 | test_sd = new OCheckListItem( tests, tr( "6. SD Card Performance " ), OCheckListItem::CheckBox ); | 115 | test_sd = new OCheckListItem( tests, tr( "6. SD Card Performance " ), OCheckListItem::CheckBox ); |
116 | test_cf = new OCheckListItem( tests, tr( "7. CF Card Performance " ), OCheckListItem::CheckBox ); | 116 | test_cf = new OCheckListItem( tests, tr( "7. CF Card Performance " ), OCheckListItem::CheckBox ); |
117 | #endif | 117 | #endif |
118 | test_alu->setText( 1, "n/a" ); | 118 | test_alu->setText( 1, "n/a" ); |
119 | test_fpu->setText( 1, "n/a" ); | 119 | test_fpu->setText( 1, "n/a" ); |
120 | test_txt->setText( 1, "n/a" ); | 120 | test_txt->setText( 1, "n/a" ); |
121 | test_gfx->setText( 1, "n/a" ); | 121 | test_gfx->setText( 1, "n/a" ); |
122 | test_ram->setText( 1, "n/a" ); | 122 | test_ram->setText( 1, "n/a" ); |
123 | #ifndef QT_QWS_RAMSES | 123 | #ifndef QT_QWS_RAMSES |
124 | test_sd->setText( 1, "n/a" ); | 124 | test_sd->setText( 1, "n/a" ); |
125 | test_cf->setText( 1, "n/a" ); | 125 | test_cf->setText( 1, "n/a" ); |
126 | #endif | 126 | #endif |
127 | test_alu->setText( 2, "n/a" ); | 127 | test_alu->setText( 2, "n/a" ); |
128 | test_fpu->setText( 2, "n/a" ); | 128 | test_fpu->setText( 2, "n/a" ); |
129 | test_txt->setText( 2, "n/a" ); | 129 | test_txt->setText( 2, "n/a" ); |
130 | test_gfx->setText( 2, "n/a" ); | 130 | test_gfx->setText( 2, "n/a" ); |
131 | test_ram->setText( 2, "n/a" ); | 131 | test_ram->setText( 2, "n/a" ); |
132 | #ifndef QT_QWS_RAMSES | 132 | #ifndef QT_QWS_RAMSES |
133 | test_sd->setText( 2, "n/a" ); | 133 | test_sd->setText( 2, "n/a" ); |
134 | test_cf->setText( 2, "n/a" ); | 134 | test_cf->setText( 2, "n/a" ); |
135 | #endif | 135 | #endif |
136 | 136 | ||
137 | startButton = new QPushButton( tr( "&Start Tests!" ), this ); | 137 | startButton = new QPushButton( tr( "&Start Tests!" ), this ); |
138 | QWhatsThis::add( startButton, tr( "Click here to perform the selected tests." ) ); | 138 | QWhatsThis::add( startButton, tr( "Click here to perform the selected tests." ) ); |
139 | connect( startButton, SIGNAL( clicked() ), this, SLOT( run() ) ); | 139 | connect( startButton, SIGNAL( clicked() ), this, SLOT( run() ) ); |
140 | vb->addWidget( tests, 2 ); | 140 | vb->addWidget( tests, 2 ); |
141 | 141 | ||
142 | QHBoxLayout* hb = new QHBoxLayout( vb ); | 142 | QHBoxLayout* hb = new QHBoxLayout( vb ); |
143 | hb->addWidget( startButton, 2 ); | 143 | hb->addWidget( startButton, 2 ); |
144 | 144 | ||
145 | QFile f( QPEApplication::qpeDir() + "/share/sysinfo/results" ); | 145 | QFile f( QPEApplication::qpeDir() + "share/sysinfo/results" ); |
146 | if ( f.open( IO_ReadOnly ) ) | 146 | if ( f.open( IO_ReadOnly ) ) |
147 | { | 147 | { |
148 | machineCombo = new QComboBox( this ); | 148 | machineCombo = new QComboBox( this ); |
149 | QWhatsThis::add( machineCombo, tr( "Choose a model to compare your results with." ) ); | 149 | QWhatsThis::add( machineCombo, tr( "Choose a model to compare your results with." ) ); |
150 | 150 | ||
151 | QTextStream ts( &f ); | 151 | QTextStream ts( &f ); |
152 | while( !ts.eof() ) | 152 | while( !ts.eof() ) |
153 | { | 153 | { |
154 | QString machline = ts.readLine(); | 154 | QString machline = ts.readLine(); |
155 | odebug << "sysinfo: parsing benchmark results for '" << machline << "'" << oendl; | 155 | odebug << "sysinfo: parsing benchmark results for '" << machline << "'" << oendl; |
156 | QString resline = ts.readLine(); | 156 | QString resline = ts.readLine(); |
157 | machines.insert( machline, new QStringList( QStringList::split( ",", resline ) ) ); | 157 | machines.insert( machline, new QStringList( QStringList::split( ",", resline ) ) ); |
158 | machineCombo->insertItem( machline ); | 158 | machineCombo->insertItem( machline ); |
159 | } | 159 | } |
160 | 160 | ||
161 | hb->addWidget( new QLabel( tr( "Compare:" ), this ) ); | 161 | hb->addWidget( new QLabel( tr( "Compare:" ), this ) ); |
162 | hb->addWidget( machineCombo, 2 ); | 162 | hb->addWidget( machineCombo, 2 ); |
163 | connect( machineCombo, SIGNAL( activated(int) ), this, SLOT( machineActivated(int) ) ); | 163 | connect( machineCombo, SIGNAL( activated(int) ), this, SLOT( machineActivated(int) ) ); |
164 | } | 164 | } |
165 | } | 165 | } |
166 | 166 | ||
167 | 167 | ||
168 | BenchmarkInfo::~BenchmarkInfo() | 168 | BenchmarkInfo::~BenchmarkInfo() |
169 | {} | 169 | {} |
170 | 170 | ||
171 | 171 | ||
172 | void BenchmarkInfo::machineActivated( int index ) | 172 | void BenchmarkInfo::machineActivated( int index ) |
173 | { | 173 | { |
174 | QStringList* results = machines[ machineCombo->text( index ) ]; | 174 | QStringList* results = machines[ machineCombo->text( index ) ]; |
175 | if ( !results ) | 175 | if ( !results ) |
176 | { | 176 | { |
177 | odebug << "sysinfo: no results available." << oendl; | 177 | odebug << "sysinfo: no results available." << oendl; |
178 | return; | 178 | return; |
179 | } | 179 | } |
180 | QStringList::Iterator it = results->begin(); | 180 | QStringList::Iterator it = results->begin(); |
181 | test_alu->setText( 2, *(it++) ); | 181 | test_alu->setText( 2, *(it++) ); |
182 | test_fpu->setText( 2, *(it++) ); | 182 | test_fpu->setText( 2, *(it++) ); |
183 | test_txt->setText( 2, *(it++) ); | 183 | test_txt->setText( 2, *(it++) ); |
184 | test_gfx->setText( 2, *(it++) ); | 184 | test_gfx->setText( 2, *(it++) ); |
185 | test_ram->setText( 2, *(it++) ); | 185 | test_ram->setText( 2, *(it++) ); |
186 | #ifndef QT_QWS_RAMSES | 186 | #ifndef QT_QWS_RAMSES |
187 | test_sd->setText( 2, *(it++) ); | 187 | test_sd->setText( 2, *(it++) ); |
188 | test_cf->setText( 2, *(it++) ); | 188 | test_cf->setText( 2, *(it++) ); |
189 | #endif | 189 | #endif |
190 | } | 190 | } |
191 | 191 | ||
192 | 192 | ||
193 | void BenchmarkInfo::run() | 193 | void BenchmarkInfo::run() |
diff --git a/noncore/settings/tabmanager/tabmanager.cpp b/noncore/settings/tabmanager/tabmanager.cpp index 3eae424..85e5814 100644 --- a/noncore/settings/tabmanager/tabmanager.cpp +++ b/noncore/settings/tabmanager/tabmanager.cpp | |||
@@ -1,72 +1,72 @@ | |||
1 | #include "tabmanager.h" | 1 | #include "tabmanager.h" |
2 | #include "app.h" | 2 | #include "app.h" |
3 | #include "wait.h" | 3 | #include "wait.h" |
4 | #include "tabapplnk.h" | 4 | #include "tabapplnk.h" |
5 | 5 | ||
6 | #include <opie2/odebug.h> | 6 | #include <opie2/odebug.h> |
7 | 7 | ||
8 | #include <qpe/applnk.h> | 8 | #include <qpe/applnk.h> |
9 | #include <qdir.h> | 9 | #include <qdir.h> |
10 | #include <qfile.h> | 10 | #include <qfile.h> |
11 | #include <qtextstream.h> | 11 | #include <qtextstream.h> |
12 | #include <qlistview.h> | 12 | #include <qlistview.h> |
13 | #include <qheader.h> | 13 | #include <qheader.h> |
14 | #include <qcombobox.h> | 14 | #include <qcombobox.h> |
15 | #include <qlineedit.h> | 15 | #include <qlineedit.h> |
16 | #include <qlabel.h> | 16 | #include <qlabel.h> |
17 | #include <qmessagebox.h> | 17 | #include <qmessagebox.h> |
18 | #include <stdlib.h> | 18 | #include <stdlib.h> |
19 | #include <qpe/qcopenvelope_qws.h> | 19 | #include <qpe/qcopenvelope_qws.h> |
20 | #include <qpe/qpeapplication.h> | 20 | #include <qpe/qpeapplication.h> |
21 | #include <qpe/resource.h> | 21 | #include <qpe/resource.h> |
22 | 22 | ||
23 | 23 | ||
24 | #define HOME_APP_DIR QPEApplication::qpeDir()+"/apps" | 24 | #define HOME_APP_DIR QPEApplication::qpeDir()+"apps" |
25 | #define HOME_APP_INSTALL_DIR "/usr/lib/ipkg/info" | 25 | #define HOME_APP_INSTALL_DIR "/usr/lib/ipkg/info" |
26 | #define NEW_FOLDER "EmptyTab" | 26 | #define NEW_FOLDER "EmptyTab" |
27 | #define NEW_APPLICATION "NewApp" | 27 | #define NEW_APPLICATION "NewApp" |
28 | #define APPLICATION_EXTENSION ".desktop" | 28 | #define APPLICATION_EXTENSION ".desktop" |
29 | #define APPLICATION_EXTENSION_LENGTH 8 | 29 | #define APPLICATION_EXTENSION_LENGTH 8 |
30 | 30 | ||
31 | /** | 31 | /** |
32 | * Constructor. Sets up signals. Performs initial scan of applications | 32 | * Constructor. Sets up signals. Performs initial scan of applications |
33 | * and tabs | 33 | * and tabs |
34 | */ | 34 | */ |
35 | TabManager::TabManager( QWidget* parent, const char* name):TabManagerBase(parent, name), changed(false), application(NULL){ | 35 | TabManager::TabManager( QWidget* parent, const char* name):TabManagerBase(parent, name), changed(false), application(NULL){ |
36 | rescanFolder(HOME_APP_DIR); | 36 | rescanFolder(HOME_APP_DIR); |
37 | 37 | ||
38 | // Connect the signals and slots | 38 | // Connect the signals and slots |
39 | connect(tabList, SIGNAL(doubleClicked(QListViewItem*)), this, SLOT(editItem(QListViewItem*))); | 39 | connect(tabList, SIGNAL(doubleClicked(QListViewItem*)), this, SLOT(editItem(QListViewItem*))); |
40 | (tabList->header())->hide(); | 40 | (tabList->header())->hide(); |
41 | connect(tabList, SIGNAL(moveItem(QListViewItem*,QListViewItem*)), this, SLOT(moveApplication(QListViewItem*,QListViewItem*))); | 41 | connect(tabList, SIGNAL(moveItem(QListViewItem*,QListViewItem*)), this, SLOT(moveApplication(QListViewItem*,QListViewItem*))); |
42 | } | 42 | } |
43 | 43 | ||
44 | /** | 44 | /** |
45 | * If anything in the tab's have been changed then update the system or alert | 45 | * If anything in the tab's have been changed then update the system or alert |
46 | * the user. | 46 | * the user. |
47 | */ | 47 | */ |
48 | TabManager::~TabManager(){ | 48 | TabManager::~TabManager(){ |
49 | if(changed){ | 49 | if(changed){ |
50 | // Prompt. | 50 | // Prompt. |
51 | //int answer = QMessageBox::warning(this, "Message", "Should your desktop be","Yes", "Cancel", 0, 1 ); | 51 | //int answer = QMessageBox::warning(this, "Message", "Should your desktop be","Yes", "Cancel", 0, 1 ); |
52 | //if (answer) | 52 | //if (answer) |
53 | // return; | 53 | // return; |
54 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); | 54 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); |
55 | QString link; //we'll just send an empty string | 55 | QString link; //we'll just send an empty string |
56 | e << link; | 56 | e << link; |
57 | } | 57 | } |
58 | } | 58 | } |
59 | 59 | ||
60 | /** | 60 | /** |
61 | * Scans root directory for any tabs or applications. Will recursivly go down, | 61 | * Scans root directory for any tabs or applications. Will recursivly go down, |
62 | * but will not follow symlinks. | 62 | * but will not follow symlinks. |
63 | * @param directory - the directory to look in. | 63 | * @param directory - the directory to look in. |
64 | * @param parent - the parent to place any new tabs or apps into. If parent is | 64 | * @param parent - the parent to place any new tabs or apps into. If parent is |
65 | * NULL then the item is a tab and should be placed as a child of the window. | 65 | * NULL then the item is a tab and should be placed as a child of the window. |
66 | */ | 66 | */ |
67 | void TabManager::rescanFolder(QString directory, QListViewItem* parent){ | 67 | void TabManager::rescanFolder(QString directory, QListViewItem* parent){ |
68 | //odebug << QString("rescanFolder: ") + directory.latin1() << oendl; | 68 | //odebug << QString("rescanFolder: ") + directory.latin1() << oendl; |
69 | 69 | ||
70 | QDir d; | 70 | QDir d; |
71 | d.setPath(directory); | 71 | d.setPath(directory); |
72 | // Show hidden files for .directories | 72 | // Show hidden files for .directories |
@@ -213,97 +213,97 @@ void TabManager::removeItem(){ | |||
213 | QMessageBox::critical(this, tr("Message"), tr("Can't remove."), tr("Ok") ); | 213 | QMessageBox::critical(this, tr("Message"), tr("Can't remove."), tr("Ok") ); |
214 | return; | 214 | return; |
215 | } | 215 | } |
216 | 216 | ||
217 | // Remove from the installer so it wont fail. | 217 | // Remove from the installer so it wont fail. |
218 | // Don't need to do this sense the current install uses rm -f so no error | 218 | // Don't need to do this sense the current install uses rm -f so no error |
219 | 219 | ||
220 | // Remove from the gui list. | 220 | // Remove from the gui list. |
221 | itemList.remove(item); | 221 | itemList.remove(item); |
222 | if(item->parent()) | 222 | if(item->parent()) |
223 | item->parent()->takeItem(item); | 223 | item->parent()->takeItem(item); |
224 | delete item; | 224 | delete item; |
225 | 225 | ||
226 | // We have changed something. | 226 | // We have changed something. |
227 | changed = true; | 227 | changed = true; |
228 | } | 228 | } |
229 | 229 | ||
230 | /** | 230 | /** |
231 | * Helper function. Edits the current item. | 231 | * Helper function. Edits the current item. |
232 | * calls editItem with the currently selected item. | 232 | * calls editItem with the currently selected item. |
233 | */ | 233 | */ |
234 | void TabManager::editCurrentItem(){ | 234 | void TabManager::editCurrentItem(){ |
235 | editItem(tabList->currentItem()); | 235 | editItem(tabList->currentItem()); |
236 | } | 236 | } |
237 | 237 | ||
238 | /** | 238 | /** |
239 | * Edit the item that is passed in. | 239 | * Edit the item that is passed in. |
240 | * Show application dialog and if anything changed | 240 | * Show application dialog and if anything changed |
241 | * @param item the item to edit. | 241 | * @param item the item to edit. |
242 | */ | 242 | */ |
243 | void TabManager::editItem( QListViewItem * item){ | 243 | void TabManager::editItem( QListViewItem * item){ |
244 | if(!item) | 244 | if(!item) |
245 | return; | 245 | return; |
246 | 246 | ||
247 | TabAppLnk app(itemList[item]); | 247 | TabAppLnk app(itemList[item]); |
248 | if(!app.isValid()){ | 248 | if(!app.isValid()){ |
249 | odebug << QString("editItem: Not a valid applnk file: ") + itemList[item].latin1() << oendl; | 249 | odebug << QString("editItem: Not a valid applnk file: ") + itemList[item].latin1() << oendl; |
250 | return; | 250 | return; |
251 | } | 251 | } |
252 | 252 | ||
253 | // Fill with all of the icons | 253 | // Fill with all of the icons |
254 | if(!application){ | 254 | if(!application){ |
255 | Wait waitDialog(this, "Wait dialog"); | 255 | Wait waitDialog(this, "Wait dialog"); |
256 | waitDialog.waitLabel->setText(tr("Gathering icons...")); | 256 | waitDialog.waitLabel->setText(tr("Gathering icons...")); |
257 | waitDialog.show(); | 257 | waitDialog.show(); |
258 | qApp->processEvents(); | 258 | qApp->processEvents(); |
259 | application = new AppEdit(this, "Application edit", true); | 259 | application = new AppEdit(this, "Application edit", true); |
260 | 260 | ||
261 | QDir d(QPEApplication::qpeDir() + "/pics/"); | 261 | QDir d(QPEApplication::qpeDir() + "pics/"); |
262 | d.setFilter( QDir::Files); | 262 | d.setFilter( QDir::Files); |
263 | 263 | ||
264 | const QFileInfoList *list = d.entryInfoList(); | 264 | const QFileInfoList *list = d.entryInfoList(); |
265 | QFileInfoListIterator it( *list ); // create list iterator | 265 | QFileInfoListIterator it( *list ); // create list iterator |
266 | QFileInfo *fi; // pointer for traversing | 266 | QFileInfo *fi; // pointer for traversing |
267 | 267 | ||
268 | while ( (fi=it.current()) ) { // for each file... | 268 | while ( (fi=it.current()) ) { // for each file... |
269 | QString fileName = fi->fileName(); | 269 | QString fileName = fi->fileName(); |
270 | if(fileName.right(4) == ".png"){ | 270 | if(fileName.right(4) == ".png"){ |
271 | fileName = fileName.mid(0,fileName.length()-4); | 271 | fileName = fileName.mid(0,fileName.length()-4); |
272 | QPixmap imageOfFile(Resource::loadPixmap(fileName)); | 272 | QPixmap imageOfFile(Resource::loadPixmap(fileName)); |
273 | QImage foo = imageOfFile.convertToImage(); | 273 | QImage foo = imageOfFile.convertToImage(); |
274 | foo = foo.smoothScale(16,16); | 274 | foo = foo.smoothScale(16,16); |
275 | imageOfFile.convertFromImage(foo); | 275 | imageOfFile.convertFromImage(foo); |
276 | application->iconLineEdit->insertItem(imageOfFile,fileName); | 276 | application->iconLineEdit->insertItem(imageOfFile,fileName); |
277 | } | 277 | } |
278 | //odebug << fi->fileName().latin1() << oendl; | 278 | //odebug << fi->fileName().latin1() << oendl; |
279 | ++it; | 279 | ++it; |
280 | } | 280 | } |
281 | waitDialog.hide(); | 281 | waitDialog.hide(); |
282 | } | 282 | } |
283 | int pixmap = -1; | 283 | int pixmap = -1; |
284 | QString pixmapText = app.pixmapString(); | 284 | QString pixmapText = app.pixmapString(); |
285 | QComboBox *f = application->iconLineEdit; | 285 | QComboBox *f = application->iconLineEdit; |
286 | for(int i = 0; i < application->iconLineEdit->count(); i++){ | 286 | for(int i = 0; i < application->iconLineEdit->count(); i++){ |
287 | if(f->text(i) == pixmapText){ | 287 | if(f->text(i) == pixmapText){ |
288 | pixmap = i; | 288 | pixmap = i; |
289 | break; | 289 | break; |
290 | } | 290 | } |
291 | } | 291 | } |
292 | if(pixmap != -1) | 292 | if(pixmap != -1) |
293 | application->iconLineEdit->setCurrentItem(pixmap); | 293 | application->iconLineEdit->setCurrentItem(pixmap); |
294 | else if(pixmapText.isEmpty()){ | 294 | else if(pixmapText.isEmpty()){ |
295 | application->iconLineEdit->setCurrentItem(0); | 295 | application->iconLineEdit->setCurrentItem(0); |
296 | } | 296 | } |
297 | else{ | 297 | else{ |
298 | QPixmap imageOfFile(Resource::loadPixmap(pixmapText)); | 298 | QPixmap imageOfFile(Resource::loadPixmap(pixmapText)); |
299 | QImage foo = imageOfFile.convertToImage(); | 299 | QImage foo = imageOfFile.convertToImage(); |
300 | foo = foo.smoothScale(16,16); | 300 | foo = foo.smoothScale(16,16); |
301 | imageOfFile.convertFromImage(foo); | 301 | imageOfFile.convertFromImage(foo); |
302 | application->iconLineEdit->insertItem(imageOfFile,pixmapText,0); | 302 | application->iconLineEdit->insertItem(imageOfFile,pixmapText,0); |
303 | application->iconLineEdit->setCurrentItem(0); | 303 | application->iconLineEdit->setCurrentItem(0); |
304 | } | 304 | } |
305 | 305 | ||
306 | application->nameLineEdit->setText(app.name()); | 306 | application->nameLineEdit->setText(app.name()); |
307 | application->execLineEdit->setText(app.exec()); | 307 | application->execLineEdit->setText(app.exec()); |
308 | application->commentLineEdit->setText(app.comment()); | 308 | application->commentLineEdit->setText(app.comment()); |
309 | 309 | ||
diff --git a/noncore/styles/theme/othemebase.cpp b/noncore/styles/theme/othemebase.cpp index d2226e6..4275dd6 100644 --- a/noncore/styles/theme/othemebase.cpp +++ b/noncore/styles/theme/othemebase.cpp | |||
@@ -261,97 +261,97 @@ void OThemeBase::readConfig( Qt::GUIStyle /*style*/ ) | |||
261 | cfg. setGroup ( "Appearance" ); | 261 | cfg. setGroup ( "Appearance" ); |
262 | 262 | ||
263 | configFileName = cfg. readEntry ( "Theme", "default" ); | 263 | configFileName = cfg. readEntry ( "Theme", "default" ); |
264 | } | 264 | } |
265 | Config config( configFilePath + "/themes/" + configFileName + ".themerc" , Config::File ); | 265 | Config config( configFilePath + "/themes/" + configFileName + ".themerc" , Config::File ); |
266 | 266 | ||
267 | // Are we initalized? | 267 | // Are we initalized? |
268 | applyMiscResourceGroup( &config ); | 268 | applyMiscResourceGroup( &config ); |
269 | for ( i = 0; i < INHERIT_ITEMS; ++i ) { | 269 | for ( i = 0; i < INHERIT_ITEMS; ++i ) { |
270 | applyResourceGroup( &config, i, copyfrom, pixnames, brdnames ); | 270 | applyResourceGroup( &config, i, copyfrom, pixnames, brdnames ); |
271 | } | 271 | } |
272 | for ( ; i < INHERIT_ITEMS*2; ++i ) { | 272 | for ( ; i < INHERIT_ITEMS*2; ++i ) { |
273 | if ( config.hasGroup( QString( widgetEntries[ i ] ) ) ) { | 273 | if ( config.hasGroup( QString( widgetEntries[ i ] ) ) ) { |
274 | applyResourceGroup( &config, i, copyfrom, pixnames, brdnames ); | 274 | applyResourceGroup( &config, i, copyfrom, pixnames, brdnames ); |
275 | } | 275 | } |
276 | else { | 276 | else { |
277 | copyfrom [ i ] = widgetEntries[ i - INHERIT_ITEMS ]; | 277 | copyfrom [ i ] = widgetEntries[ i - INHERIT_ITEMS ]; |
278 | } | 278 | } |
279 | } | 279 | } |
280 | for ( ; i < WIDGETS; ++i ) { | 280 | for ( ; i < WIDGETS; ++i ) { |
281 | applyResourceGroup( &config, i, copyfrom, pixnames, brdnames ); | 281 | applyResourceGroup( &config, i, copyfrom, pixnames, brdnames ); |
282 | } | 282 | } |
283 | 283 | ||
284 | // initalize defaults that may not be read | 284 | // initalize defaults that may not be read |
285 | for ( i = 0; i < WIDGETS; ++i ) | 285 | for ( i = 0; i < WIDGETS; ++i ) |
286 | loaded[ i ] = false; | 286 | loaded[ i ] = false; |
287 | btnXShift = btnYShift = focus3DOffset = 0; | 287 | btnXShift = btnYShift = focus3DOffset = 0; |
288 | aTabLine = iTabLine = true; | 288 | aTabLine = iTabLine = true; |
289 | roundedButton = roundedCombo = roundedSlider = focus3D = false; | 289 | roundedButton = roundedCombo = roundedSlider = focus3D = false; |
290 | splitterWidth = 10; | 290 | splitterWidth = 10; |
291 | 291 | ||
292 | for ( i = 0; i < WIDGETS; ++i ) { | 292 | for ( i = 0; i < WIDGETS; ++i ) { |
293 | readResourceGroup( i, copyfrom, pixnames, brdnames, loaded ); | 293 | readResourceGroup( i, copyfrom, pixnames, brdnames, loaded ); |
294 | } | 294 | } |
295 | 295 | ||
296 | // misc items | 296 | // misc items |
297 | readMiscResourceGroup(); | 297 | readMiscResourceGroup(); |
298 | 298 | ||
299 | // Handle preblend items | 299 | // Handle preblend items |
300 | for ( i = 0; i < PREBLEND_ITEMS; ++i ) { | 300 | for ( i = 0; i < PREBLEND_ITEMS; ++i ) { |
301 | if ( pixmaps[ preBlend[ i ] ] != NULL && blends[ preBlend[ i ] ] != 0.0 ) | 301 | if ( pixmaps[ preBlend[ i ] ] != NULL && blends[ preBlend[ i ] ] != 0.0 ) |
302 | blend( preBlend[ i ] ); | 302 | blend( preBlend[ i ] ); |
303 | } | 303 | } |
304 | } | 304 | } |
305 | 305 | ||
306 | OThemeBase::OThemeBase( const QString & configFile ) | 306 | OThemeBase::OThemeBase( const QString & configFile ) |
307 | : QWindowsStyle() | 307 | : QWindowsStyle() |
308 | { | 308 | { |
309 | configFilePath = QPEApplication::qpeDir ( ) + "/plugins/styles/"; | 309 | configFilePath = QPEApplication::qpeDir ( ) + "plugins/styles/"; |
310 | configFileName = configFile; | 310 | configFileName = configFile; |
311 | 311 | ||
312 | readConfig( Qt::WindowsStyle ); | 312 | readConfig( Qt::WindowsStyle ); |
313 | cache = new OThemeCache( cacheSize ); | 313 | cache = new OThemeCache( cacheSize ); |
314 | } | 314 | } |
315 | 315 | ||
316 | void OThemeBase::applyConfigFile( const QString &/*file*/ ) | 316 | void OThemeBase::applyConfigFile( const QString &/*file*/ ) |
317 | { | 317 | { |
318 | #if 0 | 318 | #if 0 |
319 | // handle std color scheme | 319 | // handle std color scheme |
320 | Config inConfig( file, Config::File ); | 320 | Config inConfig( file, Config::File ); |
321 | Config globalConfig ( "qpe" ); | 321 | Config globalConfig ( "qpe" ); |
322 | 322 | ||
323 | globalConfig. setGroup ( "Apperance" ); | 323 | globalConfig. setGroup ( "Apperance" ); |
324 | inConfig. setGroup( "General" ); | 324 | inConfig. setGroup( "General" ); |
325 | 325 | ||
326 | if ( inConfig.hasKey( "foreground" ) ) | 326 | if ( inConfig.hasKey( "foreground" ) ) |
327 | globalConfig.writeEntry( "Text", inConfig.readEntry( "foreground", " " ) ); | 327 | globalConfig.writeEntry( "Text", inConfig.readEntry( "foreground", " " ) ); |
328 | if ( inConfig.hasKey( "background" ) ) | 328 | if ( inConfig.hasKey( "background" ) ) |
329 | globalConfig.writeEntry( "Background", inConfig.readEntry( "background", " " ) ); | 329 | globalConfig.writeEntry( "Background", inConfig.readEntry( "background", " " ) ); |
330 | if ( inConfig.hasKey( "selectForeground" ) ) | 330 | if ( inConfig.hasKey( "selectForeground" ) ) |
331 | globalConfig.writeEntry( "HighlightedText", inConfig.readEntry( "selectForeground", " " ) ); | 331 | globalConfig.writeEntry( "HighlightedText", inConfig.readEntry( "selectForeground", " " ) ); |
332 | if ( inConfig.hasKey( "selectBackground" ) ) | 332 | if ( inConfig.hasKey( "selectBackground" ) ) |
333 | globalConfig.writeEntry( "Highlight", inConfig.readEntry( "selectBackground", " " ) ); | 333 | globalConfig.writeEntry( "Highlight", inConfig.readEntry( "selectBackground", " " ) ); |
334 | if ( inConfig.hasKey( "windowForeground" ) ) | 334 | if ( inConfig.hasKey( "windowForeground" ) ) |
335 | globalConfig.writeEntry( "Text", inConfig.readEntry( "windowForeground", " " ) ); | 335 | globalConfig.writeEntry( "Text", inConfig.readEntry( "windowForeground", " " ) ); |
336 | if ( inConfig.hasKey( "windowBackground" ) ) | 336 | if ( inConfig.hasKey( "windowBackground" ) ) |
337 | globalConfig.writeEntry( "Base", inConfig.readEntry( "windowBackground", " " ) ); | 337 | globalConfig.writeEntry( "Base", inConfig.readEntry( "windowBackground", " " ) ); |
338 | 338 | ||
339 | // Keep track of the current theme so that we can select the right one | 339 | // Keep track of the current theme so that we can select the right one |
340 | // in the KControl module. | 340 | // in the KControl module. |
341 | globalConfig.writeEntry ( "CurrentTheme", file ); | 341 | globalConfig.writeEntry ( "CurrentTheme", file ); |
342 | 342 | ||
343 | globalConfig.write(); | 343 | globalConfig.write(); |
344 | #endif | 344 | #endif |
345 | } | 345 | } |
346 | 346 | ||
347 | OThemeBase::~OThemeBase() | 347 | OThemeBase::~OThemeBase() |
348 | { | 348 | { |
349 | int i; | 349 | int i; |
350 | for ( i = 0; i < WIDGETS; ++i ) { | 350 | for ( i = 0; i < WIDGETS; ++i ) { |
351 | if ( !duplicate[ i ] ) { | 351 | if ( !duplicate[ i ] ) { |
352 | if ( images[ i ] ) | 352 | if ( images[ i ] ) |
353 | delete images[ i ]; | 353 | delete images[ i ]; |
354 | if ( pixmaps[ i ] ) | 354 | if ( pixmaps[ i ] ) |
355 | delete pixmaps[ i ]; | 355 | delete pixmaps[ i ]; |
356 | } | 356 | } |
357 | if ( !pbDuplicate[ i ] && pbPixmaps[ i ] ) | 357 | if ( !pbDuplicate[ i ] && pbPixmaps[ i ] ) |
diff --git a/noncore/styles/theme/themeset.cpp b/noncore/styles/theme/themeset.cpp index d4005bc..3205106 100644 --- a/noncore/styles/theme/themeset.cpp +++ b/noncore/styles/theme/themeset.cpp | |||
@@ -41,84 +41,84 @@ public: | |||
41 | 41 | ||
42 | bool hasGroup ( const QString &gname ) const | 42 | bool hasGroup ( const QString &gname ) const |
43 | { | 43 | { |
44 | QMap< QString, ConfigGroup>::ConstIterator it = groups. find ( gname ); | 44 | QMap< QString, ConfigGroup>::ConstIterator it = groups. find ( gname ); |
45 | return ( it != groups.end() ); | 45 | return ( it != groups.end() ); |
46 | } | 46 | } |
47 | }; | 47 | }; |
48 | 48 | ||
49 | class MyItem : public QListViewItem | 49 | class MyItem : public QListViewItem |
50 | { | 50 | { |
51 | public: | 51 | public: |
52 | MyItem ( QListView *lv, QListViewItem *after, const QString &name, const QString &comm, const QString &theme ) : QListViewItem ( lv, after, name, comm ) | 52 | MyItem ( QListView *lv, QListViewItem *after, const QString &name, const QString &comm, const QString &theme ) : QListViewItem ( lv, after, name, comm ) |
53 | { | 53 | { |
54 | m_theme = theme; | 54 | m_theme = theme; |
55 | } | 55 | } |
56 | 56 | ||
57 | 57 | ||
58 | QString m_theme; | 58 | QString m_theme; |
59 | }; | 59 | }; |
60 | 60 | ||
61 | 61 | ||
62 | ThemeSettings::ThemeSettings ( QWidget* parent, const char *name, WFlags fl ) | 62 | ThemeSettings::ThemeSettings ( QWidget* parent, const char *name, WFlags fl ) |
63 | : QWidget ( parent, name, fl ) | 63 | : QWidget ( parent, name, fl ) |
64 | { | 64 | { |
65 | setCaption ( tr( "Theme Style" ) ); | 65 | setCaption ( tr( "Theme Style" ) ); |
66 | 66 | ||
67 | Config config ( "qpe" ); | 67 | Config config ( "qpe" ); |
68 | config. setGroup ( "Appearance" ); | 68 | config. setGroup ( "Appearance" ); |
69 | 69 | ||
70 | QString active = config. readEntry ( "Theme", "default" ); | 70 | QString active = config. readEntry ( "Theme", "default" ); |
71 | 71 | ||
72 | QVBoxLayout *vbox = new QVBoxLayout ( this ); | 72 | QVBoxLayout *vbox = new QVBoxLayout ( this ); |
73 | vbox-> setSpacing ( 3 ); | 73 | vbox-> setSpacing ( 3 ); |
74 | vbox-> setMargin ( 6 ); | 74 | vbox-> setMargin ( 6 ); |
75 | 75 | ||
76 | vbox-> addWidget ( new QLabel ( tr( "Select the theme to be used" ), this )); | 76 | vbox-> addWidget ( new QLabel ( tr( "Select the theme to be used" ), this )); |
77 | 77 | ||
78 | m_list = new QListView ( this ); | 78 | m_list = new QListView ( this ); |
79 | m_list-> addColumn ( tr( "Name" )); | 79 | m_list-> addColumn ( tr( "Name" )); |
80 | m_list-> addColumn ( tr( "Description" )); | 80 | m_list-> addColumn ( tr( "Description" )); |
81 | m_list-> setSelectionMode ( QListView::Single ); | 81 | m_list-> setSelectionMode ( QListView::Single ); |
82 | m_list-> setAllColumnsShowFocus ( true ); | 82 | m_list-> setAllColumnsShowFocus ( true ); |
83 | m_list-> setSorting ( -1 ); | 83 | m_list-> setSorting ( -1 ); |
84 | vbox-> addWidget ( m_list, 10 ); | 84 | vbox-> addWidget ( m_list, 10 ); |
85 | 85 | ||
86 | QListViewItem *item = new MyItem ( m_list, 0, tr( "[No theme]" ), "", "" ); | 86 | QListViewItem *item = new MyItem ( m_list, 0, tr( "[No theme]" ), "", "" ); |
87 | m_list-> setSelected ( item, true ); | 87 | m_list-> setSelected ( item, true ); |
88 | 88 | ||
89 | QString path = QPEApplication::qpeDir() + "/plugins/styles/themes"; | 89 | QString path = QPEApplication::qpeDir() + "plugins/styles/themes"; |
90 | QStringList list = QDir ( path, "*.themerc" ). entryList ( ); | 90 | QStringList list = QDir ( path, "*.themerc" ). entryList ( ); |
91 | 91 | ||
92 | for ( QStringList::Iterator it = list. begin(); it != list. end ( ); ++it ) { | 92 | for ( QStringList::Iterator it = list. begin(); it != list. end ( ); ++it ) { |
93 | MyConfig cfg ( path + "/" + *it, Config::File ); | 93 | MyConfig cfg ( path + "/" + *it, Config::File ); |
94 | 94 | ||
95 | if ( cfg. hasGroup ( "Misc" )) { | 95 | if ( cfg. hasGroup ( "Misc" )) { |
96 | cfg. setGroup ( "Misc" ); | 96 | cfg. setGroup ( "Misc" ); |
97 | 97 | ||
98 | QString name = cfg. readEntry ( "Name" ); | 98 | QString name = cfg. readEntry ( "Name" ); |
99 | QString comm = cfg. readEntry ( "Comment" ); | 99 | QString comm = cfg. readEntry ( "Comment" ); |
100 | 100 | ||
101 | if ( !name. isEmpty ( )) { | 101 | if ( !name. isEmpty ( )) { |
102 | QString fname = (*it). left ((*it). length ( ) - 8 ); | 102 | QString fname = (*it). left ((*it). length ( ) - 8 ); |
103 | 103 | ||
104 | item = new MyItem ( m_list, item, name, comm, fname ); | 104 | item = new MyItem ( m_list, item, name, comm, fname ); |
105 | if ( active == fname ) { | 105 | if ( active == fname ) { |
106 | m_list-> setSelected ( item, true ); | 106 | m_list-> setSelected ( item, true ); |
107 | } | 107 | } |
108 | } | 108 | } |
109 | } | 109 | } |
110 | } | 110 | } |
111 | } | 111 | } |
112 | 112 | ||
113 | bool ThemeSettings::writeConfig ( ) | 113 | bool ThemeSettings::writeConfig ( ) |
114 | { | 114 | { |
115 | Config config ( "qpe" ); | 115 | Config config ( "qpe" ); |
116 | config. setGroup ( "Appearance" ); | 116 | config. setGroup ( "Appearance" ); |
117 | 117 | ||
118 | MyItem *it = (MyItem *) m_list-> selectedItem ( ); | 118 | MyItem *it = (MyItem *) m_list-> selectedItem ( ); |
119 | config. writeEntry ( "Theme", it ? it-> m_theme : QString ( "" )); | 119 | config. writeEntry ( "Theme", it ? it-> m_theme : QString ( "" )); |
120 | config. write ( ); | 120 | config. write ( ); |
121 | 121 | ||
122 | return true; | 122 | return true; |
123 | } | 123 | } |
124 | 124 | ||
diff --git a/noncore/tools/calc2/calc.cpp b/noncore/tools/calc2/calc.cpp index 3dcdf6e..c7656bf 100644 --- a/noncore/tools/calc2/calc.cpp +++ b/noncore/tools/calc2/calc.cpp | |||
@@ -15,90 +15,90 @@ | |||
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include <qvaluelist.h> | 21 | #include <qvaluelist.h> |
22 | #include <qpe/qpeapplication.h> | 22 | #include <qpe/qpeapplication.h> |
23 | #include <qdir.h> | 23 | #include <qdir.h> |
24 | #include <qwidgetstack.h> | 24 | #include <qwidgetstack.h> |
25 | 25 | ||
26 | #include "calc.h" | 26 | #include "calc.h" |
27 | #include "plugininterface.h" | 27 | #include "plugininterface.h" |
28 | 28 | ||
29 | calc::calc (QWidget * p, const char *n):QWidget (p, n) | 29 | calc::calc (QWidget * p, const char *n):QWidget (p, n) |
30 | { | 30 | { |
31 | setCaption (tr ("Calculator")); | 31 | setCaption (tr ("Calculator")); |
32 | 32 | ||
33 | // widgets | 33 | // widgets |
34 | LCD = new QLCDNumber (this); | 34 | LCD = new QLCDNumber (this); |
35 | LCD->setMaximumSize (QSize (240, 30)); | 35 | LCD->setMaximumSize (QSize (240, 30)); |
36 | LCD->setNumDigits(12); | 36 | LCD->setNumDigits(12); |
37 | LCD->setSegmentStyle(QLCDNumber::Filled); | 37 | LCD->setSegmentStyle(QLCDNumber::Filled); |
38 | pluginWidgetStack = new QWidgetStack (this); | 38 | pluginWidgetStack = new QWidgetStack (this); |
39 | 39 | ||
40 | // layout widgets | 40 | // layout widgets |
41 | calculatorLayout = new QVBoxLayout (this); | 41 | calculatorLayout = new QVBoxLayout (this); |
42 | calculatorLayout->addWidget (LCD); | 42 | calculatorLayout->addWidget (LCD); |
43 | calculatorLayout->addWidget (pluginWidgetStack); | 43 | calculatorLayout->addWidget (pluginWidgetStack); |
44 | 44 | ||
45 | // no formatting of display for now | 45 | // no formatting of display for now |
46 | connect (&engine, SIGNAL(display(double)), LCD, SLOT(display(double))); | 46 | connect (&engine, SIGNAL(display(double)), LCD, SLOT(display(double))); |
47 | connect (&engine, SIGNAL(display(const QString&)), LCD, SLOT(display(const QString&))); | 47 | connect (&engine, SIGNAL(display(const QString&)), LCD, SLOT(display(const QString&))); |
48 | connect (&engine, SIGNAL(setBinMode()), LCD, SLOT(setBinMode())); | 48 | connect (&engine, SIGNAL(setBinMode()), LCD, SLOT(setBinMode())); |
49 | connect (&engine, SIGNAL(setOctMode()), LCD, SLOT(setOctMode())); | 49 | connect (&engine, SIGNAL(setOctMode()), LCD, SLOT(setOctMode())); |
50 | connect (&engine, SIGNAL(setDecMode()), LCD, SLOT(setDecMode())); | 50 | connect (&engine, SIGNAL(setDecMode()), LCD, SLOT(setDecMode())); |
51 | connect (&engine, SIGNAL(setHexMode()), LCD, SLOT(setHexMode())); | 51 | connect (&engine, SIGNAL(setHexMode()), LCD, SLOT(setHexMode())); |
52 | 52 | ||
53 | #ifndef NO_PLUGINS | 53 | #ifndef NO_PLUGINS |
54 | // load plugins | 54 | // load plugins |
55 | QValueList < Plugin >::Iterator mit; | 55 | QValueList < Plugin >::Iterator mit; |
56 | for (mit = pluginList.begin (); mit != pluginList.end (); ++mit) { | 56 | for (mit = pluginList.begin (); mit != pluginList.end (); ++mit) { |
57 | (*mit).interface->release (); | 57 | (*mit).interface->release (); |
58 | (*mit).library->unload (); | 58 | (*mit).library->unload (); |
59 | delete (*mit).library; | 59 | delete (*mit).library; |
60 | } | 60 | } |
61 | pluginList.clear (); | 61 | pluginList.clear (); |
62 | 62 | ||
63 | QString path = QPEApplication::qpeDir() + "/plugins/calculator"; | 63 | QString path = QPEApplication::qpeDir() + "plugins/calculator"; |
64 | QDir dir (path, "lib*.so"); | 64 | QDir dir (path, "lib*.so"); |
65 | QStringList list = dir.entryList (); | 65 | QStringList list = dir.entryList (); |
66 | 66 | ||
67 | QStringList::Iterator it; | 67 | QStringList::Iterator it; |
68 | for (it = list.begin (); it != list.end (); ++it) { | 68 | for (it = list.begin (); it != list.end (); ++it) { |
69 | CalcInterface *iface = 0; | 69 | CalcInterface *iface = 0; |
70 | QLibrary *lib = new QLibrary (path + "/" + *it); | 70 | QLibrary *lib = new QLibrary (path + "/" + *it); |
71 | 71 | ||
72 | Plugin plugin; | 72 | Plugin plugin; |
73 | plugin.pluginWidget = 0; | 73 | plugin.pluginWidget = 0; |
74 | 74 | ||
75 | if (lib->queryInterface (IID_Calc, (QUnknownInterface **) & iface) == | 75 | if (lib->queryInterface (IID_Calc, (QUnknownInterface **) & iface) == |
76 | QS_OK) { | 76 | QS_OK) { |
77 | plugin.library = lib; | 77 | plugin.library = lib; |
78 | plugin.interface = iface; | 78 | plugin.interface = iface; |
79 | plugin.pluginWidget = plugin.interface->getPlugin(&engine,pluginWidgetStack); | 79 | plugin.pluginWidget = plugin.interface->getPlugin(&engine,pluginWidgetStack); |
80 | if (plugin.pluginWidget) | 80 | if (plugin.pluginWidget) |
81 | pluginWidgetStack->addWidget (plugin.pluginWidget, pluginList.count()); | 81 | pluginWidgetStack->addWidget (plugin.pluginWidget, pluginList.count()); |
82 | pluginList.append (plugin); | 82 | pluginList.append (plugin); |
83 | } else { | 83 | } else { |
84 | delete lib; | 84 | delete lib; |
85 | } | 85 | } |
86 | } | 86 | } |
87 | setMode (1); | 87 | setMode (1); |
88 | #else | 88 | #else |
89 | // load simple interface | 89 | // load simple interface |
90 | #endif | 90 | #endif |
91 | } | 91 | } |
92 | 92 | ||
93 | calc::~calc () | 93 | calc::~calc () |
94 | { | 94 | { |
95 | #ifndef NO_PLUGINS | 95 | #ifndef NO_PLUGINS |
96 | QValueList < Plugin >::Iterator mit; | 96 | QValueList < Plugin >::Iterator mit; |
97 | for (mit = pluginList.begin (); mit != pluginList.end (); ++mit) { | 97 | for (mit = pluginList.begin (); mit != pluginList.end (); ++mit) { |
98 | (*mit).interface->release (); | 98 | (*mit).interface->release (); |
99 | (*mit).library->unload (); | 99 | (*mit).library->unload (); |
100 | delete (*mit).library; | 100 | delete (*mit).library; |
101 | } | 101 | } |
102 | #endif | 102 | #endif |
103 | } | 103 | } |
104 | 104 | ||