Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.26 KB | None | 0 0
  1.     void IrcAccountConfigurationDialog::DeleteElement (const QString& key, const QModelIndex& index, const QString& message)
  2.     {
  3.         int ret = QMessageBox::warning (this, "LeechCraft",
  4.                 message,
  5.                 QMessageBox::Ok | QMessageBox::Cancel,
  6.                 QMessageBox::Cancel);
  7.  
  8.         if (ret == QMessageBox::Ok)
  9.             for (int i = ServersInfo_.count () - 1; i >= 0; --i)
  10.             {
  11.                 if (key == "Channels")
  12.                 {
  13.                     for (int j = ServersInfo_.count () - 1; j >= 0; --j)
  14.                     {
  15.                         if (ServersInfo_.at (j).toMap () ["Name"] == index.parent ().data () &&
  16.                                 ServersInfo_.at (j).toMap () ["Network"] == index.parent ().parent ().data ())
  17.                         {
  18.                             QStringList list = ServersInfo_.at (j).toMap () ["Channels"].toStringList ();
  19.                            
  20.                             for (int k = list.count () - 1; k >= 0; --k)
  21.                             {
  22.                                 QString str = list.at (k);
  23.                                 if (str.split (' ').at (0) == index.data ().toString ())
  24.                                     list.removeAt (k);
  25.                             }
  26.                            
  27.                             QMap<QString, QVariant> map = ServersInfo_.at (j).toMap ();
  28.                             map ["Channels"] = QStringList () + list;
  29.                             ServersInfo_ [j] = map;
  30.                         }
  31.                     }
  32.                 }
  33.                 else if (ServersInfo_.at (i).toMap () [key].toString () == index.data ().toString ())
  34.                     ServersInfo_.removeAt (i);
  35.             }
  36.         SetServersInfo (ServersInfo_);
  37.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement