-rw-r--r-- | microkde/kdeui/ktoolbar.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/microkde/kdeui/ktoolbar.cpp b/microkde/kdeui/ktoolbar.cpp index 35d4916..36ede81 100644 --- a/microkde/kdeui/ktoolbar.cpp +++ b/microkde/kdeui/ktoolbar.cpp | |||
@@ -1068,192 +1068,193 @@ void KToolBar::setFlat (bool flag) | |||
1068 | /*US | 1068 | /*US |
1069 | if ( mainWindow()->inherits( "KMainWindow" ) ) | 1069 | if ( mainWindow()->inherits( "KMainWindow" ) ) |
1070 | static_cast<KMainWindow *>(mainWindow())->setSettingsDirty(); | 1070 | static_cast<KMainWindow *>(mainWindow())->setSettingsDirty(); |
1071 | */ | 1071 | */ |
1072 | } | 1072 | } |
1073 | 1073 | ||
1074 | 1074 | ||
1075 | int KToolBar::count() const | 1075 | int KToolBar::count() const |
1076 | { | 1076 | { |
1077 | return id2widget.count(); | 1077 | return id2widget.count(); |
1078 | } | 1078 | } |
1079 | 1079 | ||
1080 | 1080 | ||
1081 | void KToolBar::saveState() | 1081 | void KToolBar::saveState() |
1082 | { | 1082 | { |
1083 | /*US | 1083 | /*US |
1084 | // first, try to save to the xml file | 1084 | // first, try to save to the xml file |
1085 | if ( d->m_xmlguiClient && !d->m_xmlguiClient->xmlFile().isEmpty() ) { | 1085 | if ( d->m_xmlguiClient && !d->m_xmlguiClient->xmlFile().isEmpty() ) { |
1086 | // go down one level to get to the right tags | 1086 | // go down one level to get to the right tags |
1087 | QDomElement elem = d->m_xmlguiClient->domDocument().documentElement().toElement(); | 1087 | QDomElement elem = d->m_xmlguiClient->domDocument().documentElement().toElement(); |
1088 | elem = elem.firstChild().toElement(); | 1088 | elem = elem.firstChild().toElement(); |
1089 | QString barname(!::qstrcmp(name(), "unnamed") ? "mainToolBar" : name()); | 1089 | QString barname(!::qstrcmp(name(), "unnamed") ? "mainToolBar" : name()); |
1090 | QDomElement current; | 1090 | QDomElement current; |
1091 | // now try to find our toolbar | 1091 | // now try to find our toolbar |
1092 | d->modified = false; | 1092 | d->modified = false; |
1093 | for( ; !elem.isNull(); elem = elem.nextSibling().toElement() ) { | 1093 | for( ; !elem.isNull(); elem = elem.nextSibling().toElement() ) { |
1094 | current = elem; | 1094 | current = elem; |
1095 | 1095 | ||
1096 | if ( current.tagName().lower() != "toolbar" ) | 1096 | if ( current.tagName().lower() != "toolbar" ) |
1097 | continue; | 1097 | continue; |
1098 | 1098 | ||
1099 | QString curname(current.attribute( "name" )); | 1099 | QString curname(current.attribute( "name" )); |
1100 | 1100 | ||
1101 | if ( curname == barname ) { | 1101 | if ( curname == barname ) { |
1102 | saveState( current ); | 1102 | saveState( current ); |
1103 | break; | 1103 | break; |
1104 | } | 1104 | } |
1105 | } | 1105 | } |
1106 | // if we didn't make changes, then just return | 1106 | // if we didn't make changes, then just return |
1107 | if ( !d->modified ) | 1107 | if ( !d->modified ) |
1108 | return; | 1108 | return; |
1109 | 1109 | ||
1110 | // now we load in the (non-merged) local file | 1110 | // now we load in the (non-merged) local file |
1111 | QString local_xml(KXMLGUIFactory::readConfigFile(d->m_xmlguiClient->xmlFile(), true, d->m_xmlguiClient->instance())); | 1111 | QString local_xml(KXMLGUIFactory::readConfigFile(d->m_xmlguiClient->xmlFile(), true, d->m_xmlguiClient->instance())); |
1112 | QDomDocument local; | 1112 | QDomDocument local; |
1113 | local.setContent(local_xml); | 1113 | local.setContent(local_xml); |
1114 | 1114 | ||
1115 | // make sure we don't append if this toolbar already exists locally | 1115 | // make sure we don't append if this toolbar already exists locally |
1116 | bool just_append = true; | 1116 | bool just_append = true; |
1117 | elem = local.documentElement().toElement(); | 1117 | elem = local.documentElement().toElement(); |
1118 | KXMLGUIFactory::removeDOMComments( elem ); | 1118 | KXMLGUIFactory::removeDOMComments( elem ); |
1119 | elem = elem.firstChild().toElement(); | 1119 | elem = elem.firstChild().toElement(); |
1120 | for( ; !elem.isNull(); elem = elem.nextSibling().toElement() ) { | 1120 | for( ; !elem.isNull(); elem = elem.nextSibling().toElement() ) { |
1121 | if ( elem.tagName().lower() != "toolbar" ) | 1121 | if ( elem.tagName().lower() != "toolbar" ) |
1122 | continue; | 1122 | continue; |
1123 | 1123 | ||
1124 | QString curname(elem.attribute( "name" )); | 1124 | QString curname(elem.attribute( "name" )); |
1125 | 1125 | ||
1126 | if ( curname == barname ) { | 1126 | if ( curname == barname ) { |
1127 | just_append = false; | 1127 | just_append = false; |
1128 | local.documentElement().replaceChild( current, elem ); | 1128 | local.documentElement().replaceChild( current, elem ); |
1129 | break; | 1129 | break; |
1130 | } | 1130 | } |
1131 | } | 1131 | } |
1132 | 1132 | ||
1133 | if (just_append) | 1133 | if (just_append) |
1134 | local.documentElement().appendChild( current ); | 1134 | local.documentElement().appendChild( current ); |
1135 | 1135 | ||
1136 | KXMLGUIFactory::saveConfigFile(local, d->m_xmlguiClient->localXMLFile(), d->m_xmlguiClient->instance() ); | 1136 | KXMLGUIFactory::saveConfigFile(local, d->m_xmlguiClient->localXMLFile(), d->m_xmlguiClient->instance() ); |
1137 | 1137 | ||
1138 | return; | 1138 | return; |
1139 | } | 1139 | } |
1140 | */ | 1140 | */ |
1141 | // if that didn't work, we save to the config file | 1141 | // if that didn't work, we save to the config file |
1142 | KConfig *config = KGlobal::config(); | 1142 | KConfig *config = KGlobal::config(); |
1143 | saveSettings(config, QString::null); | 1143 | saveSettings(config, QString::null); |
1144 | config->sync(); | 1144 | config->sync(); |
1145 | } | 1145 | } |
1146 | 1146 | ||
1147 | QString KToolBar::settingsGroup() | 1147 | QString KToolBar::settingsGroup() |
1148 | { | 1148 | { |
1149 | QString configGroup; | 1149 | QString configGroup; |
1150 | if (!::qstrcmp(name(), "unnamed") || !::qstrcmp(name(), "mainToolBar")) | 1150 | if (!::qstrcmp(name(), "unnamed") || !::qstrcmp(name(), "mainToolBar")) |
1151 | configGroup = "Toolbar style"; | 1151 | configGroup = "Toolbar style"; |
1152 | else | 1152 | else |
1153 | configGroup = QString(name()) + " Toolbar style"; | 1153 | configGroup = QString(name()) + " Toolbar style"; |
1154 | if ( this->mainWindow() ) | 1154 | if ( this->mainWindow() ) |
1155 | { | 1155 | { |
1156 | configGroup.prepend(" "); | 1156 | configGroup.prepend(" "); |
1157 | configGroup.prepend( this->mainWindow()->name() ); | 1157 | configGroup.prepend( this->mainWindow()->name() ); |
1158 | } | 1158 | } |
1159 | return configGroup; | 1159 | return configGroup; |
1160 | } | 1160 | } |
1161 | 1161 | ||
1162 | void KToolBar::saveSettings(KConfig *config, const QString &_configGroup) | 1162 | void KToolBar::saveSettings(KConfig *config, const QString &_configGroup) |
1163 | { | 1163 | { |
1164 | return; | ||
1164 | QString configGroup = _configGroup; | 1165 | QString configGroup = _configGroup; |
1165 | if (configGroup.isEmpty()) | 1166 | if (configGroup.isEmpty()) |
1166 | configGroup = settingsGroup(); | 1167 | configGroup = settingsGroup(); |
1167 | //kdDebug(220) << "KToolBar::saveSettings group=" << _configGroup << " -> " << configGroup << endl; | 1168 | //kdDebug(220) << "KToolBar::saveSettings group=" << _configGroup << " -> " << configGroup << endl; |
1168 | 1169 | ||
1169 | QString position, icontext; | 1170 | QString position, icontext; |
1170 | int index; | 1171 | int index; |
1171 | getAttributes( position, icontext, index ); | 1172 | getAttributes( position, icontext, index ); |
1172 | 1173 | ||
1173 | //kdDebug(220) << "KToolBar::saveSettings " << name() << " newLine=" << newLine << endl; | 1174 | //kdDebug(220) << "KToolBar::saveSettings " << name() << " newLine=" << newLine << endl; |
1174 | 1175 | ||
1175 | KConfigGroupSaver saver(config, configGroup); | 1176 | KConfigGroupSaver saver(config, configGroup); |
1176 | 1177 | ||
1177 | if ( position != d->PositionDefault ) | 1178 | if ( position != d->PositionDefault ) |
1178 | config->writeEntry("Position", position); | 1179 | config->writeEntry("Position", position); |
1179 | else | 1180 | else |
1180 | config->deleteEntry("Position"); | 1181 | config->deleteEntry("Position"); |
1181 | 1182 | ||
1182 | if ( icontext != d->IconTextDefault ) | 1183 | if ( icontext != d->IconTextDefault ) |
1183 | config->writeEntry("IconText", icontext); | 1184 | config->writeEntry("IconText", icontext); |
1184 | else | 1185 | else |
1185 | config->deleteEntry("IconText"); | 1186 | config->deleteEntry("IconText"); |
1186 | 1187 | ||
1187 | if ( iconSize() != d->IconSizeDefault ) | 1188 | if ( iconSize() != d->IconSizeDefault ) |
1188 | config->writeEntry("IconSize", iconSize()); | 1189 | config->writeEntry("IconSize", iconSize()); |
1189 | else | 1190 | else |
1190 | config->deleteEntry("IconSize"); | 1191 | config->deleteEntry("IconSize"); |
1191 | 1192 | ||
1192 | if ( isHidden() != d->HiddenDefault ) | 1193 | if ( isHidden() != d->HiddenDefault ) |
1193 | config->writeEntry("Hidden", isHidden()); | 1194 | config->writeEntry("Hidden", isHidden()); |
1194 | else | 1195 | else |
1195 | config->deleteEntry("Hidden"); | 1196 | config->deleteEntry("Hidden"); |
1196 | 1197 | ||
1197 | if ( index != d->IndexDefault ) | 1198 | if ( index != d->IndexDefault ) |
1198 | config->writeEntry( "Index", index ); | 1199 | config->writeEntry( "Index", index ); |
1199 | else | 1200 | else |
1200 | config->deleteEntry("Index"); | 1201 | config->deleteEntry("Index"); |
1201 | //US the older version of KDE (used on the Zaurus) has no Offset property | 1202 | //US the older version of KDE (used on the Zaurus) has no Offset property |
1202 | /* if ( offset() != d->OffsetDefault ) | 1203 | /* if ( offset() != d->OffsetDefault ) |
1203 | config->writeEntry( "Offset", offset() ); | 1204 | config->writeEntry( "Offset", offset() ); |
1204 | else | 1205 | else |
1205 | */ | 1206 | */ |
1206 | config->deleteEntry("Offset"); | 1207 | config->deleteEntry("Offset"); |
1207 | 1208 | ||
1208 | //US the older version of KDE (used on the Zaurus) has no NewLine property | 1209 | //US the older version of KDE (used on the Zaurus) has no NewLine property |
1209 | /* | 1210 | /* |
1210 | if ( newLine() != d->NewLineDefault ) | 1211 | if ( newLine() != d->NewLineDefault ) |
1211 | config->writeEntry( "NewLine", newLine() ); | 1212 | config->writeEntry( "NewLine", newLine() ); |
1212 | else | 1213 | else |
1213 | */ | 1214 | */ |
1214 | config->deleteEntry("NewLine"); | 1215 | config->deleteEntry("NewLine"); |
1215 | } | 1216 | } |
1216 | 1217 | ||
1217 | void KToolBar::setXMLGUIClient( KXMLGUIClient *client ) | 1218 | void KToolBar::setXMLGUIClient( KXMLGUIClient *client ) |
1218 | { | 1219 | { |
1219 | d->m_xmlguiClient = client; | 1220 | d->m_xmlguiClient = client; |
1220 | } | 1221 | } |
1221 | 1222 | ||
1222 | void KToolBar::setText( const QString & txt ) | 1223 | void KToolBar::setText( const QString & txt ) |
1223 | { | 1224 | { |
1224 | //US setLabel( txt + " ( " + kapp->caption() + " ) " ); | 1225 | //US setLabel( txt + " ( " + kapp->caption() + " ) " ); |
1225 | setLabel( txt + " ( " + KGlobal::getAppName() + " ) " ); | 1226 | setLabel( txt + " ( " + KGlobal::getAppName() + " ) " ); |
1226 | } | 1227 | } |
1227 | 1228 | ||
1228 | 1229 | ||
1229 | QString KToolBar::text() const | 1230 | QString KToolBar::text() const |
1230 | { | 1231 | { |
1231 | return label(); | 1232 | return label(); |
1232 | } | 1233 | } |
1233 | 1234 | ||
1234 | 1235 | ||
1235 | void KToolBar::doConnections( KToolBarButton *button ) | 1236 | void KToolBar::doConnections( KToolBarButton *button ) |
1236 | { | 1237 | { |
1237 | connect(button, SIGNAL(clicked(int)), this, SIGNAL( clicked( int ) ) ); | 1238 | connect(button, SIGNAL(clicked(int)), this, SIGNAL( clicked( int ) ) ); |
1238 | connect(button, SIGNAL(doubleClicked(int)), this, SIGNAL( doubleClicked( int ) ) ); | 1239 | connect(button, SIGNAL(doubleClicked(int)), this, SIGNAL( doubleClicked( int ) ) ); |
1239 | connect(button, SIGNAL(released(int)), this, SIGNAL( released( int ) ) ); | 1240 | connect(button, SIGNAL(released(int)), this, SIGNAL( released( int ) ) ); |
1240 | connect(button, SIGNAL(pressed(int)), this, SIGNAL( pressed( int ) ) ); | 1241 | connect(button, SIGNAL(pressed(int)), this, SIGNAL( pressed( int ) ) ); |
1241 | connect(button, SIGNAL(toggled(int)), this, SIGNAL( toggled( int ) ) ); | 1242 | connect(button, SIGNAL(toggled(int)), this, SIGNAL( toggled( int ) ) ); |
1242 | connect(button, SIGNAL(highlighted(int, bool)), this, SIGNAL( highlighted( int, bool ) ) ); | 1243 | connect(button, SIGNAL(highlighted(int, bool)), this, SIGNAL( highlighted( int, bool ) ) ); |
1243 | } | 1244 | } |
1244 | 1245 | ||
1245 | void KToolBar::mousePressEvent ( QMouseEvent *m ) | 1246 | void KToolBar::mousePressEvent ( QMouseEvent *m ) |
1246 | { | 1247 | { |
1247 | if ( !mainWindow() ) | 1248 | if ( !mainWindow() ) |
1248 | return; | 1249 | return; |
1249 | QMainWindow *mw = mainWindow(); | 1250 | QMainWindow *mw = mainWindow(); |
1250 | if ( mw->toolBarsMovable() && d->m_enableContext ) { | 1251 | if ( mw->toolBarsMovable() && d->m_enableContext ) { |
1251 | if ( m->button() == RightButton ) { | 1252 | if ( m->button() == RightButton ) { |
1252 | int i = contextMenu()->exec( m->globalPos(), 0 ); | 1253 | int i = contextMenu()->exec( m->globalPos(), 0 ); |
1253 | switch ( i ) { | 1254 | switch ( i ) { |
1254 | case -1: | 1255 | case -1: |
1255 | return; // popup cancelled | 1256 | return; // popup cancelled |
1256 | case CONTEXT_LEFT: | 1257 | case CONTEXT_LEFT: |
1257 | //US mw->moveDockWindow( this, DockLeft ); | 1258 | //US mw->moveDockWindow( this, DockLeft ); |
1258 | mw->moveToolBar( this, QMainWindow::Left ); | 1259 | mw->moveToolBar( this, QMainWindow::Left ); |
1259 | break; | 1260 | break; |
@@ -1511,192 +1512,193 @@ QSize KToolBar::minimumSize() const | |||
1511 | 1512 | ||
1512 | QSize KToolBar::minimumSizeHint() const | 1513 | QSize KToolBar::minimumSizeHint() const |
1513 | { | 1514 | { |
1514 | return sizeHint(); | 1515 | return sizeHint(); |
1515 | } | 1516 | } |
1516 | 1517 | ||
1517 | bool KToolBar::highlight() const | 1518 | bool KToolBar::highlight() const |
1518 | { | 1519 | { |
1519 | return d->m_highlight; | 1520 | return d->m_highlight; |
1520 | } | 1521 | } |
1521 | 1522 | ||
1522 | void KToolBar::hide() | 1523 | void KToolBar::hide() |
1523 | { | 1524 | { |
1524 | QToolBar::hide(); | 1525 | QToolBar::hide(); |
1525 | } | 1526 | } |
1526 | 1527 | ||
1527 | void KToolBar::show() | 1528 | void KToolBar::show() |
1528 | { | 1529 | { |
1529 | QToolBar::show(); | 1530 | QToolBar::show(); |
1530 | } | 1531 | } |
1531 | 1532 | ||
1532 | void KToolBar::resizeEvent( QResizeEvent *e ) | 1533 | void KToolBar::resizeEvent( QResizeEvent *e ) |
1533 | { | 1534 | { |
1534 | bool b = isUpdatesEnabled(); | 1535 | bool b = isUpdatesEnabled(); |
1535 | setUpdatesEnabled( FALSE ); | 1536 | setUpdatesEnabled( FALSE ); |
1536 | QToolBar::resizeEvent( e ); | 1537 | QToolBar::resizeEvent( e ); |
1537 | if (b) | 1538 | if (b) |
1538 | d->repaintTimer.start( 100, true ); | 1539 | d->repaintTimer.start( 100, true ); |
1539 | } | 1540 | } |
1540 | 1541 | ||
1541 | void KToolBar::slotIconChanged(int group) | 1542 | void KToolBar::slotIconChanged(int group) |
1542 | { | 1543 | { |
1543 | if ((group != KIcon::Toolbar) && (group != KIcon::MainToolbar)) | 1544 | if ((group != KIcon::Toolbar) && (group != KIcon::MainToolbar)) |
1544 | return; | 1545 | return; |
1545 | if ((group == KIcon::MainToolbar) != !::qstrcmp(name(), "mainToolBar")) | 1546 | if ((group == KIcon::MainToolbar) != !::qstrcmp(name(), "mainToolBar")) |
1546 | return; | 1547 | return; |
1547 | 1548 | ||
1548 | emit modechange(); | 1549 | emit modechange(); |
1549 | if (isVisible()) | 1550 | if (isVisible()) |
1550 | updateGeometry(); | 1551 | updateGeometry(); |
1551 | } | 1552 | } |
1552 | 1553 | ||
1553 | void KToolBar::slotReadConfig() | 1554 | void KToolBar::slotReadConfig() |
1554 | { | 1555 | { |
1555 | //kdDebug(220) << "KToolBar::slotReadConfig" << endl; | 1556 | //kdDebug(220) << "KToolBar::slotReadConfig" << endl; |
1556 | // Read appearance settings (hmm, we used to do both here, | 1557 | // Read appearance settings (hmm, we used to do both here, |
1557 | // but a well behaved application will call applyMainWindowSettings | 1558 | // but a well behaved application will call applyMainWindowSettings |
1558 | // anyway, right ?) | 1559 | // anyway, right ?) |
1559 | applyAppearanceSettings(KGlobal::config(), QString::null ); | 1560 | applyAppearanceSettings(KGlobal::config(), QString::null ); |
1560 | } | 1561 | } |
1561 | 1562 | ||
1562 | void KToolBar::slotAppearanceChanged() | 1563 | void KToolBar::slotAppearanceChanged() |
1563 | { | 1564 | { |
1564 | // Read appearance settings from global file. | 1565 | // Read appearance settings from global file. |
1565 | applyAppearanceSettings(KGlobal::config(), QString::null, true /* lose local settings */ ); | 1566 | applyAppearanceSettings(KGlobal::config(), QString::null, true /* lose local settings */ ); |
1566 | // And remember to save the new look later | 1567 | // And remember to save the new look later |
1567 | /*US | 1568 | /*US |
1568 | if ( mainWindow() && mainWindow()->inherits( "KMainWindow" ) ) | 1569 | if ( mainWindow() && mainWindow()->inherits( "KMainWindow" ) ) |
1569 | static_cast<KMainWindow *>(mainWindow())->setSettingsDirty(); | 1570 | static_cast<KMainWindow *>(mainWindow())->setSettingsDirty(); |
1570 | */ | 1571 | */ |
1571 | } | 1572 | } |
1572 | 1573 | ||
1573 | //static | 1574 | //static |
1574 | bool KToolBar::highlightSetting() | 1575 | bool KToolBar::highlightSetting() |
1575 | { | 1576 | { |
1576 | QString grpToolbar(QString::fromLatin1("Toolbar style")); | 1577 | QString grpToolbar(QString::fromLatin1("Toolbar style")); |
1577 | KConfigGroupSaver saver(KGlobal::config(), grpToolbar); | 1578 | KConfigGroupSaver saver(KGlobal::config(), grpToolbar); |
1578 | return KGlobal::config()->readBoolEntry(QString::fromLatin1("Highlighting"),true); | 1579 | return KGlobal::config()->readBoolEntry(QString::fromLatin1("Highlighting"),true); |
1579 | } | 1580 | } |
1580 | 1581 | ||
1581 | //static | 1582 | //static |
1582 | bool KToolBar::transparentSetting() | 1583 | bool KToolBar::transparentSetting() |
1583 | { | 1584 | { |
1584 | QString grpToolbar(QString::fromLatin1("Toolbar style")); | 1585 | QString grpToolbar(QString::fromLatin1("Toolbar style")); |
1585 | KConfigGroupSaver saver(KGlobal::config(), grpToolbar); | 1586 | KConfigGroupSaver saver(KGlobal::config(), grpToolbar); |
1586 | return KGlobal::config()->readBoolEntry(QString::fromLatin1("TransparentMoving"),true); | 1587 | return KGlobal::config()->readBoolEntry(QString::fromLatin1("TransparentMoving"),true); |
1587 | } | 1588 | } |
1588 | 1589 | ||
1589 | //static | 1590 | //static |
1590 | KToolBar::IconText KToolBar::iconTextSetting() | 1591 | KToolBar::IconText KToolBar::iconTextSetting() |
1591 | { | 1592 | { |
1592 | QString grpToolbar(QString::fromLatin1("Toolbar style")); | 1593 | QString grpToolbar(QString::fromLatin1("Toolbar style")); |
1593 | KConfigGroupSaver saver(KGlobal::config(), grpToolbar); | 1594 | KConfigGroupSaver saver(KGlobal::config(), grpToolbar); |
1594 | QString icontext = KGlobal::config()->readEntry(QString::fromLatin1("IconText"),QString::fromLatin1("IconOnly")); | 1595 | QString icontext = KGlobal::config()->readEntry(QString::fromLatin1("IconText"),QString::fromLatin1("IconOnly")); |
1595 | if ( icontext == "IconTextRight" ) | 1596 | if ( icontext == "IconTextRight" ) |
1596 | return IconTextRight; | 1597 | return IconTextRight; |
1597 | else if ( icontext == "IconTextBottom" ) | 1598 | else if ( icontext == "IconTextBottom" ) |
1598 | return IconTextBottom; | 1599 | return IconTextBottom; |
1599 | else if ( icontext == "TextOnly" ) | 1600 | else if ( icontext == "TextOnly" ) |
1600 | return TextOnly; | 1601 | return TextOnly; |
1601 | else | 1602 | else |
1602 | return IconOnly; | 1603 | return IconOnly; |
1603 | } | 1604 | } |
1604 | 1605 | ||
1605 | void KToolBar::applyAppearanceSettings(KConfig *config, const QString &_configGroup, bool forceGlobal) | 1606 | void KToolBar::applyAppearanceSettings(KConfig *config, const QString &_configGroup, bool forceGlobal) |
1606 | { | 1607 | { |
1608 | return; | ||
1607 | QString configGroup = _configGroup.isEmpty() ? settingsGroup() : _configGroup; | 1609 | QString configGroup = _configGroup.isEmpty() ? settingsGroup() : _configGroup; |
1608 | //kdDebug(220) << "KToolBar::applyAppearanceSettings: configGroup=" << configGroup << endl; | 1610 | //kdDebug(220) << "KToolBar::applyAppearanceSettings: configGroup=" << configGroup << endl; |
1609 | // We have application-specific settings in the XML file, | 1611 | // We have application-specific settings in the XML file, |
1610 | // and nothing in the application's config file | 1612 | // and nothing in the application's config file |
1611 | // -> don't apply the global defaults, the XML ones are preferred | 1613 | // -> don't apply the global defaults, the XML ones are preferred |
1612 | // See applySettings for a full explanation | 1614 | // See applySettings for a full explanation |
1613 | /*US :we do not support xml files | 1615 | /*US :we do not support xml files |
1614 | if ( d->m_xmlguiClient && !d->m_xmlguiClient->xmlFile().isEmpty() && | 1616 | if ( d->m_xmlguiClient && !d->m_xmlguiClient->xmlFile().isEmpty() && |
1615 | !config->hasGroup(configGroup) ) | 1617 | !config->hasGroup(configGroup) ) |
1616 | { | 1618 | { |
1617 | //kdDebug(220) << "skipping global defaults, using XML ones instead" << endl; | 1619 | //kdDebug(220) << "skipping global defaults, using XML ones instead" << endl; |
1618 | return; | 1620 | return; |
1619 | } | 1621 | } |
1620 | */ | 1622 | */ |
1621 | if ( !config->hasGroup(configGroup) ) | 1623 | if ( !config->hasGroup(configGroup) ) |
1622 | { | 1624 | { |
1623 | //kdDebug(220) << "skipping global defaults, using XML ones instead" << endl; | 1625 | //kdDebug(220) << "skipping global defaults, using XML ones instead" << endl; |
1624 | return; | 1626 | return; |
1625 | } | 1627 | } |
1626 | 1628 | ||
1627 | 1629 | ||
1628 | KConfig *gconfig = KGlobal::config(); | 1630 | KConfig *gconfig = KGlobal::config(); |
1629 | /*US | 1631 | /*US |
1630 | static const QString &attrIconText = KGlobal::staticQString("IconText"); | 1632 | static const QString &attrIconText = KGlobal::staticQString("IconText"); |
1631 | static const QString &attrHighlight = KGlobal::staticQString("Highlighting"); | 1633 | static const QString &attrHighlight = KGlobal::staticQString("Highlighting"); |
1632 | static const QString &attrTrans = KGlobal::staticQString("TransparentMoving"); | 1634 | static const QString &attrTrans = KGlobal::staticQString("TransparentMoving"); |
1633 | static const QString &attrSize = KGlobal::staticQString("IconSize"); | 1635 | static const QString &attrSize = KGlobal::staticQString("IconSize"); |
1634 | */ | 1636 | */ |
1635 | // we actually do this in two steps. | 1637 | // we actually do this in two steps. |
1636 | // First, we read in the global styles [Toolbar style] (from the KControl module). | 1638 | // First, we read in the global styles [Toolbar style] (from the KControl module). |
1637 | // Then, if the toolbar is NOT 'mainToolBar', we will also try to read in [barname Toolbar style] | 1639 | // Then, if the toolbar is NOT 'mainToolBar', we will also try to read in [barname Toolbar style] |
1638 | bool highlight; | 1640 | bool highlight; |
1639 | int transparent; | 1641 | int transparent; |
1640 | QString icontext; | 1642 | QString icontext; |
1641 | int iconsize = 0; | 1643 | int iconsize = 0; |
1642 | 1644 | ||
1643 | // this is the first iteration | 1645 | // this is the first iteration |
1644 | QString grpToolbar(QString::fromLatin1("Toolbar style")); | 1646 | QString grpToolbar(QString::fromLatin1("Toolbar style")); |
1645 | { // start block for KConfigGroupSaver | 1647 | { // start block for KConfigGroupSaver |
1646 | KConfigGroupSaver saver(gconfig, grpToolbar); | 1648 | KConfigGroupSaver saver(gconfig, grpToolbar); |
1647 | 1649 | ||
1648 | // first, get the generic settings | 1650 | // first, get the generic settings |
1649 | //US highlight = gconfig->readBoolEntry(attrHighlight, true); | 1651 | //US highlight = gconfig->readBoolEntry(attrHighlight, true); |
1650 | highlight = gconfig->readBoolEntry("Highlighting", true); | 1652 | highlight = gconfig->readBoolEntry("Highlighting", true); |
1651 | //US transparent = gconfig->readBoolEntry(attrTrans, true); | 1653 | //US transparent = gconfig->readBoolEntry(attrTrans, true); |
1652 | transparent = gconfig->readBoolEntry("TransparentMoving", true); | 1654 | transparent = gconfig->readBoolEntry("TransparentMoving", true); |
1653 | 1655 | ||
1654 | // we read in the IconText property *only* if we intend on actually | 1656 | // we read in the IconText property *only* if we intend on actually |
1655 | // honoring it | 1657 | // honoring it |
1656 | if (d->m_honorStyle) | 1658 | if (d->m_honorStyle) |
1657 | //US d->IconTextDefault = gconfig->readEntry(attrIconText, d->IconTextDefault); | 1659 | //US d->IconTextDefault = gconfig->readEntry(attrIconText, d->IconTextDefault); |
1658 | d->IconTextDefault = gconfig->readEntry("IconText", d->IconTextDefault); | 1660 | d->IconTextDefault = gconfig->readEntry("IconText", d->IconTextDefault); |
1659 | else | 1661 | else |
1660 | d->IconTextDefault = "IconOnly"; | 1662 | d->IconTextDefault = "IconOnly"; |
1661 | 1663 | ||
1662 | // Use the default icon size for toolbar icons. | 1664 | // Use the default icon size for toolbar icons. |
1663 | //US d->IconSizeDefault = gconfig->readNumEntry(attrSize, d->IconSizeDefault); | 1665 | //US d->IconSizeDefault = gconfig->readNumEntry(attrSize, d->IconSizeDefault); |
1664 | d->IconSizeDefault = gconfig->readNumEntry("IconSize", d->IconSizeDefault); | 1666 | d->IconSizeDefault = gconfig->readNumEntry("IconSize", d->IconSizeDefault); |
1665 | 1667 | ||
1666 | if ( !forceGlobal && config->hasGroup(configGroup) ) | 1668 | if ( !forceGlobal && config->hasGroup(configGroup) ) |
1667 | { | 1669 | { |
1668 | config->setGroup(configGroup); | 1670 | config->setGroup(configGroup); |
1669 | 1671 | ||
1670 | // first, get the generic settings | 1672 | // first, get the generic settings |
1671 | //US highlight = config->readBoolEntry(attrHighlight, highlight); | 1673 | //US highlight = config->readBoolEntry(attrHighlight, highlight); |
1672 | highlight = config->readBoolEntry("Highlighting", highlight); | 1674 | highlight = config->readBoolEntry("Highlighting", highlight); |
1673 | //US transparent = config->readBoolEntry(attrTrans, transparent); | 1675 | //US transparent = config->readBoolEntry(attrTrans, transparent); |
1674 | transparent = config->readBoolEntry("TransparentMoving", transparent); | 1676 | transparent = config->readBoolEntry("TransparentMoving", transparent); |
1675 | // now we always read in the IconText property | 1677 | // now we always read in the IconText property |
1676 | //US icontext = config->readEntry(attrIconText, d->IconTextDefault); | 1678 | //US icontext = config->readEntry(attrIconText, d->IconTextDefault); |
1677 | icontext = config->readEntry("IconText", d->IconTextDefault); | 1679 | icontext = config->readEntry("IconText", d->IconTextDefault); |
1678 | 1680 | ||
1679 | // now get the size | 1681 | // now get the size |
1680 | //US iconsize = config->readNumEntry(attrSize, d->IconSizeDefault); | 1682 | //US iconsize = config->readNumEntry(attrSize, d->IconSizeDefault); |
1681 | iconsize = config->readNumEntry("IconSize", d->IconSizeDefault); | 1683 | iconsize = config->readNumEntry("IconSize", d->IconSizeDefault); |
1682 | } | 1684 | } |
1683 | else | 1685 | else |
1684 | { | 1686 | { |
1685 | iconsize = d->IconSizeDefault; | 1687 | iconsize = d->IconSizeDefault; |
1686 | icontext = d->IconTextDefault; | 1688 | icontext = d->IconTextDefault; |
1687 | } | 1689 | } |
1688 | 1690 | ||
1689 | // revert back to the old group | 1691 | // revert back to the old group |
1690 | } // end block for KConfigGroupSaver | 1692 | } // end block for KConfigGroupSaver |
1691 | 1693 | ||
1692 | bool doUpdate = false; | 1694 | bool doUpdate = false; |
1693 | 1695 | ||
1694 | IconText icon_text; | 1696 | IconText icon_text; |
1695 | if ( icontext == "IconTextRight" ) | 1697 | if ( icontext == "IconTextRight" ) |
1696 | icon_text = IconTextRight; | 1698 | icon_text = IconTextRight; |
1697 | else if ( icontext == "IconTextBottom" ) | 1699 | else if ( icontext == "IconTextBottom" ) |
1698 | icon_text = IconTextBottom; | 1700 | icon_text = IconTextBottom; |
1699 | else if ( icontext == "TextOnly" ) | 1701 | else if ( icontext == "TextOnly" ) |
1700 | icon_text = TextOnly; | 1702 | icon_text = TextOnly; |
1701 | else | 1703 | else |
1702 | icon_text = IconOnly; | 1704 | icon_text = IconOnly; |