~ubuntu-branches/ubuntu/lucid/ktorrent/lucid

« back to all changes in this revision

Viewing changes to libbtcore/torrent/torrent.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Thomas
  • Date: 2009-04-06 08:32:32 UTC
  • mfrom: (1.1.26 upstream)
  • Revision ID: james.westby@ubuntu.com-20090406083232-rpyq88977lfpgnfo
Tags: 3.2.1+dfsg.1-0ubuntu1
* New upstream release (LP: #356230):
  - Add libtag1-dev to build-depends

Show diffs side-by-side

added added

removed removed

Lines of Context:
268
268
                }
269
269
        }
270
270
        
 
271
        
 
272
#ifdef Q_WS_WIN
 
273
        static QString NameForWindows(const QString & name)
 
274
        {
 
275
                QString ret = name;
 
276
                char invalid[] = {'<','>',':','"','/','\\','|','?','*'};
 
277
                for (int i = 0;i < 9;i++)
 
278
                {
 
279
                        if (ret.contains(invalid[i]))
 
280
                                ret = ret.replace(invalid[i],'_');
 
281
                }
 
282
                
 
283
                return ret;
 
284
        }
 
285
#endif
 
286
 
271
287
        void Torrent::loadName(BValueNode* node)
272
288
        {
273
289
                if (!node || node->data().getType() != Value::STRING)
275
291
                
276
292
                unencoded_name = node->data().toByteArray();
277
293
                name_suggestion = text_codec->toUnicode(unencoded_name);
 
294
#ifdef Q_WS_WIN
 
295
                name_suggestion = NameForWindows(name_suggestion);
 
296
#endif
278
297
        }
279
298
        
280
299
        void Torrent::loadAnnounceList(BNode* node)
541
560
                        f.changeTextCodec(codec);
542
561
                }
543
562
                name_suggestion = text_codec->toUnicode(unencoded_name);
 
563
#ifdef Q_WS_WIN
 
564
                name_suggestion = NameForWindows(name_suggestion);
 
565
#endif
544
566
        }
545
567
        
546
568
        void Torrent::downloadPriorityChanged(TorrentFile* tf,Priority newpriority,Priority oldpriority)