Browse Source

[Web UI] Fix empty trackers addition

adaptive-webui-19844
ngosang 10 years ago
parent
commit
62b803e268
  1. 7
      src/webui/webapplication.cpp
  2. 8
      src/webui/www/public/properties_content.html

7
src/webui/webapplication.cpp

@ -359,8 +359,11 @@ void WebApplication::action_command_addTrackers()
BitTorrent::TorrentHandle *const torrent = BitTorrent::Session::instance()->findTorrent(hash); BitTorrent::TorrentHandle *const torrent = BitTorrent::Session::instance()->findTorrent(hash);
if (torrent) { if (torrent) {
QList<BitTorrent::TrackerEntry> trackers; QList<BitTorrent::TrackerEntry> trackers;
foreach (const QString &url, request().posts["urls"].split('\n')) foreach (QString url, request().posts["urls"].split('\n')) {
trackers << url; url = url.trimmed();
if (!url.isEmpty())
trackers << url;
}
torrent->addTrackers(trackers); torrent->addTrackers(trackers);
} }
} }

8
src/webui/www/public/properties_content.html

@ -27,10 +27,10 @@
<table class="torrentTable" cellpadding="0" cellspacing="0" style="width: 100%"> <table class="torrentTable" cellpadding="0" cellspacing="0" style="width: 100%">
<thead> <thead>
<tr> <tr>
<th>QBT_TR(URL)QBT_TR <img src="theme/list-add" id="addTrackersPlus"/></th> <th style="width: 30%;">QBT_TR(URL)QBT_TR <img src="theme/list-add" id="addTrackersPlus"/></th>
<th style="width: 250px;">QBT_TR(Status)QBT_TR</th> <th style="width: 10%;">QBT_TR(Status)QBT_TR</th>
<th style="width: 150px;">QBT_TR(Peers)QBT_TR</th> <th style="width: 10%;">QBT_TR(Peers)QBT_TR</th>
<th style="width: 200px;">QBT_TR(Message)QBT_TR</th> <th style="width: 50%;">QBT_TR(Message)QBT_TR</th>
</tr> </tr>
</thead> </thead>
<tbody id="trackersTable"></tbody> <tbody id="trackersTable"></tbody>

Loading…
Cancel
Save