~ubuntu-branches/ubuntu/wily/psi/wily-proposed

« back to all changes in this revision

Viewing changes to src/mucconfigdlg.cpp

  • Committer: Package Import Robot
  • Author(s): Jan Niehusmann
  • Date: 2014-07-01 21:49:34 UTC
  • mfrom: (6.1.7 sid)
  • Revision ID: package-import@ubuntu.com-20140701214934-gt4dkgm94byi4vnn
Tags: 0.15-1
* New upstream version
* set debhelper compat level to 9
* set Standards-Version to 3.9.5 (no further changes)
* add lintian override regarding license-problem-non-free-RFC
* use qconf to regenerate configure script
* implement hardening using buildflags instead of hardening-wrapper

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
 *
15
15
 * You should have received a copy of the GNU General Public License
16
16
 * along with this library; if not, write to the Free Software
17
 
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
17
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
18
 *
19
19
 */
20
20
 
158
158
{
159
159
        bool ok;
160
160
        QString text = QInputDialog::getText(this, tr("Add affiliation"), tr("Enter the JID of the user:"), QLineEdit::Normal, "", &ok);
161
 
        if (ok) {
162
 
           if (text.isEmpty() || !ui_.tv_affiliations->addToCurrent(text))
163
 
                   QMessageBox::critical(this, tr("Error"), tr("You have entered an invalid JID."));
 
161
        if (ok && ui_.tv_affiliations->currentIndex().isValid()) {
 
162
                if (!text.isEmpty()) {
 
163
 
 
164
                        QModelIndex index = affiliations_proxy_model_->mapToSource(ui_.tv_affiliations->currentIndex());
 
165
 
 
166
                        if (index.parent().isValid())
 
167
                                index = index.parent();
 
168
 
 
169
                        if (!index.parent().isValid()) {
 
170
                                XMPP::Jid jid(text);
 
171
                                if (jid.isValid()) {
 
172
 
 
173
                                        // TODO: Check if the user is already in the list
 
174
 
 
175
                                        int row = affiliations_model_->rowCount(index);
 
176
                                        affiliations_model_->insertRows(row,1,index);
 
177
                                        QModelIndex newIndex = affiliations_model_->index(row,0,index);
 
178
                                        affiliations_model_->setData(newIndex, QVariant(jid.bare()));
 
179
                                        ui_.tv_affiliations->setCurrentIndex(affiliations_proxy_model_->mapFromSource(newIndex));
 
180
                                        return;
 
181
                                }
 
182
                        }
 
183
                }
 
184
 
 
185
                QMessageBox::critical(this, tr("Error"), tr("You have entered an invalid JID."));
164
186
        }
165
187
}
166
188