Changeset View
Changeset View
Standalone View
Standalone View
uploadprofilemodel.cpp
Show First 20 Lines • Show All 61 Lines • ▼ Show 20 Line(s) | |||||
62 | void UploadProfileModel::revert() | 62 | void UploadProfileModel::revert() | ||
63 | { | 63 | { | ||
64 | KConfigGroup group = m_project->projectConfiguration()->group("Upload"); | 64 | KConfigGroup group = m_project->projectConfiguration()->group("Upload"); | ||
65 | QString defProfile = group.readEntry("default", QString()); | 65 | QString defProfile = group.readEntry("default", QString()); | ||
66 | int row = 0; | 66 | int row = 0; | ||
67 | Q_FOREACH (QString g, group.groupList()) { | 67 | Q_FOREACH (QString g, group.groupList()) { | ||
68 | if (g.startsWith("Profile")) { | 68 | if (g.startsWith("Profile")) { | ||
69 | QUrl url = group.group(g).readEntry("url", QUrl()); | 69 | QUrl url = group.group(g).readEntry("url", QUrl()); | ||
70 | QUrl localUrl = group.group(g).readEntry("localUrl", QUrl()); | ||||
70 | QString name = group.group(g).readEntry("name", QString()); | 71 | QString name = group.group(g).readEntry("name", QString()); | ||
71 | UploadProfileItem* i = uploadItem(row); | 72 | UploadProfileItem* i = uploadItem(row); | ||
72 | if (!i) { | 73 | if (!i) { | ||
73 | i = new UploadProfileItem(); | 74 | i = new UploadProfileItem(); | ||
74 | insertRow(row, i); | 75 | insertRow(row, i); | ||
75 | } | 76 | } | ||
76 | i->setText(name); | 77 | i->setText(name); | ||
77 | i->setUrl(url); | 78 | i->setUrl(url); | ||
79 | i->setLocalUrl(localUrl); | ||||
78 | i->setProfileNr(g.mid(7)); //group-name | 80 | i->setProfileNr(g.mid(7)); //group-name | ||
79 | i->setDefault(i->profileNr() == defProfile); | 81 | i->setDefault(i->profileNr() == defProfile); | ||
80 | ++row; | 82 | ++row; | ||
81 | } | 83 | } | ||
82 | } | 84 | } | ||
83 | for (int i = row; i < rowCount(); ++i) { | 85 | for (int i = row; i < rowCount(); ++i) { | ||
84 | qDeleteAll(takeRow(i)); | 86 | qDeleteAll(takeRow(i)); | ||
85 | } | 87 | } | ||
Show All 17 Lines | 91 | { | |||
103 | for (int i = 0; i < rowCount(); i++) { | 105 | for (int i = 0; i < rowCount(); i++) { | ||
104 | UploadProfileItem* item = uploadItem(i); | 106 | UploadProfileItem* item = uploadItem(i); | ||
105 | if (item) { | 107 | if (item) { | ||
106 | if (item->profileNr().isEmpty()) { | 108 | if (item->profileNr().isEmpty()) { | ||
107 | item->setProfileNr(QString::number(++maxProfileNr)); | 109 | item->setProfileNr(QString::number(++maxProfileNr)); | ||
108 | } | 110 | } | ||
109 | KConfigGroup profileGroup = group.group("Profile" + item->profileNr()); | 111 | KConfigGroup profileGroup = group.group("Profile" + item->profileNr()); | ||
110 | profileGroup.writeEntry("url", item->url().toString()); | 112 | profileGroup.writeEntry("url", item->url().toString()); | ||
113 | profileGroup.writeEntry("localUrl", item->localUrl().toString()); | ||||
111 | profileGroup.writeEntry("name", item->text()); | 114 | profileGroup.writeEntry("name", item->text()); | ||
112 | if (item->isDefault()) { | 115 | if (item->isDefault()) { | ||
113 | defaultProfileNr = item->profileNr(); | 116 | defaultProfileNr = item->profileNr(); | ||
114 | } | 117 | } | ||
115 | } | 118 | } | ||
116 | } | 119 | } | ||
117 | group.writeEntry("default", defaultProfileNr); | 120 | group.writeEntry("default", defaultProfileNr); | ||
118 | return true; | 121 | return true; | ||
119 | } | 122 | } | ||
120 | 123 | | |||
121 | 124 | | |||
122 | // kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on | 125 | // kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on |