author | hash <hash> | 2002-08-23 18:28:03 (UTC) |
---|---|---|
committer | hash <hash> | 2002-08-23 18:28:03 (UTC) |
commit | 4e1a0d708c7ff0b7b1c3ad15bcae933b76e1ae5e (patch) (side-by-side diff) | |
tree | 95731dcac369953c863e93ba0df3c2e90abff7d3 | |
parent | 3e37e49a35b786e5da747d4e19e898fb7135533c (diff) | |
download | opie-4e1a0d708c7ff0b7b1c3ad15bcae933b76e1ae5e.zip opie-4e1a0d708c7ff0b7b1c3ad15bcae933b76e1ae5e.tar.gz opie-4e1a0d708c7ff0b7b1c3ad15bcae933b76e1ae5e.tar.bz2 |
oops, fixed bug in color buttons
-rw-r--r-- | inputmethods/multikey/configdlg.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/inputmethods/multikey/configdlg.cpp b/inputmethods/multikey/configdlg.cpp index 9576579..10bc611 100644 --- a/inputmethods/multikey/configdlg.cpp +++ b/inputmethods/multikey/configdlg.cpp @@ -180,188 +180,188 @@ ConfigDlg::ConfigDlg () : QTabWidget () keycolor_lines_button->setFlat((bool)1); color = config.readListEntry("keycolor_lines", QChar(',')); keycolor_lines_button->setPalette(QPalette((QColor(color[0].toInt(), color[1].toInt(), color[2].toInt())))); label = new QLabel(tr("Text Color"), color_box); textcolor_button = new QPushButton(color_box); connect(textcolor_button, SIGNAL(clicked()), SLOT(textColorClicked())); textcolor_button->setFlat((bool)1); color = config.readListEntry("textcolor", QChar(',')); textcolor_button->setPalette(QPalette((QColor(color[0].toInt(), color[1].toInt(), color[2].toInt())))); label = new QLabel("", color_box); // a spacer so the above buttons dont expand label->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); } void ConfigDlg::pickTog() { Config config ("multikey"); config.setGroup ("general"); config.writeEntry ("usePickboard", pick_button->isChecked()); // default closed emit pickboardToggled(pick_button->isChecked()); } void ConfigDlg::repeatTog() { Config config ("multikey"); config.setGroup ("general"); config.writeEntry ("useRepeat", repeat_button->isChecked()); // default closed emit repeatToggled(repeat_button->isChecked()); } // ConfigDlg::setMap {{{1 /* * the index is kinda screwy, because in the config file, index 0 is just the * first element in the QStringList, but here it's the "Current Language" * listItem. therefor you have to minus one to the index before you access it. * */ void ConfigDlg::setMap(int index) { if (index == 0) { remove_button->setDisabled(true); emit setMapToDefault(); } else if ((uint)index <= default_maps.count()) { remove_button->setDisabled(true); emit setMapToFile(keymaps->text(index)); } else { remove_button->setEnabled(true); emit setMapToFile(keymaps->text(index)); } } // ConfigDlg::addMap() {{{1 void ConfigDlg::addMap() { QString map = OFileDialog::getOpenFileName(1, QDir::home().absPath()); if (map.isNull()) return; Config config ("multikey"); config.setGroup("keymaps"); QStringList maps = config.readListEntry("maps", QChar('|')); maps.append(map); keymaps->insertItem(map); keymaps->setSelected(keymaps->count() - 1, true); config.writeEntry("maps", maps, QChar('|')); config.writeEntry("current", map); } // ConfigDlg::removeMap() {{{1 void ConfigDlg::removeMap() { cout << "removing : " << custom_maps[keymaps->currentItem() - default_maps.count() - 1] << "\n"; cout << "currentItem : " << keymaps->currentItem() << "\n"; // move selection up one keymaps->setSelected(keymaps->currentItem() - 1, true); // delete the next selected item cus you just moved it up keymaps->removeItem(keymaps->currentItem() + 1); custom_maps.remove(custom_maps[keymaps->currentItem() - default_maps.count()]); // write the changes Config config ("multikey"); config.setGroup("keymaps"); config.writeEntry("maps", custom_maps, QChar('|')); } /* ConfigDlg::slots for the color buttons {{{1 * * these four slots are almost the same, except for the names. i was thinking * of making a map with pointers to the buttons and names of the configEntry * so it could be one slot, but then there would be no way of telling which * of the buttons was clicked if they all connect to the same slot. * */ void ConfigDlg::keyColorClicked() { Config config ("multikey"); config.setGroup ("colors"); QStringList color = config.readListEntry("keycolor", QChar(',')); QColor newcolor = OColorDialog::getColor(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt())); color[0].setNum(newcolor.red()); color[1].setNum(newcolor.green()); color[2].setNum(newcolor.blue()); config.writeEntry("keycolor", color, QChar(',')); config.write(); - keycolor_button->setBackgroundColor(newcolor); + keycolor_button->setPalette(QPalette(newcolor)); emit reloadKeyboard(); } void ConfigDlg::keyColorPressedClicked() { Config config ("multikey"); config.setGroup ("colors"); QStringList color = config.readListEntry("keycolor_pressed", QChar(',')); QColor newcolor = OColorDialog::getColor(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt())); color[0].setNum(newcolor.red()); color[1].setNum(newcolor.green()); color[2].setNum(newcolor.blue()); config.writeEntry("keycolor_pressed", color, QChar(',')); config.write(); - keycolor_pressed_button->setBackgroundColor(newcolor); + keycolor_pressed_button->setPalette(QPalette(newcolor)); emit reloadKeyboard(); } void ConfigDlg::keyColorLinesClicked() { Config config ("multikey"); config.setGroup ("colors"); QStringList color = config.readListEntry("keycolor_lines", QChar(',')); QColor newcolor = OColorDialog::getColor(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt())); color[0].setNum(newcolor.red()); color[1].setNum(newcolor.green()); color[2].setNum(newcolor.blue()); config.writeEntry("keycolor_lines", color, QChar(',')); config.write(); - keycolor_lines_button->setBackgroundColor(newcolor); + keycolor_lines_button->setPalette(QPalette(newcolor)); emit reloadKeyboard(); } void ConfigDlg::textColorClicked() { Config config ("multikey"); config.setGroup ("colors"); QStringList color = config.readListEntry("textcolor", QChar(',')); QColor newcolor = OColorDialog::getColor(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt())); color[0].setNum(newcolor.red()); color[1].setNum(newcolor.green()); color[2].setNum(newcolor.blue()); config.writeEntry("textcolor", color, QChar(',')); config.write(); - textcolor_button->setBackgroundColor(newcolor); + textcolor_button->setPalette(QPalette(newcolor)); emit reloadKeyboard(); } |