QTfrontend/ui/widget/chatwidget.cpp
changeset 6202 8e3f006b9b1e
parent 6201 d88e7f6cf499
child 6205 7764cbe4ddd7
--- a/QTfrontend/ui/widget/chatwidget.cpp	Mon Oct 24 22:46:35 2011 +0200
+++ b/QTfrontend/ui/widget/chatwidget.cpp	Mon Oct 24 23:24:01 2011 +0200
@@ -762,17 +762,24 @@
     if (event->mimeData()->hasUrls())
     {
         QList<QUrl> urls = event->mimeData()->urls();
-        QString url = urls[0].toString();
         if (urls.count() == 1)
-            if (url.contains(QRegExp("^file://.*\\.css$")))
+        {
+            QUrl url = urls[0];
+
+            static QRegExp localFileRegExp("file://.*\\.css$");
+            localFileRegExp.setCaseSensitivity(Qt::CaseInsensitive);
+
+            if (url.toString().contains(localFileRegExp))
                 event->acceptProposedAction();
+        }
     }
 }
 
 void HWChatWidget::dropEvent(QDropEvent * event)
 {
     const QString path(event->mimeData()->urls()[0].toString());
-    QFile file(QString(path).remove(QRegExp("^file://")));
+
+    QFile file(event->mimeData()->urls()[0].toLocalFile());
 
     if (file.exists() && (file.open(QIODevice::ReadOnly | QIODevice::Text)))
     {
@@ -781,8 +788,7 @@
         while (!in.atEnd())
         {
             QString line = in.readLine();
-            if(!line.isEmpty())
-                style.append(line);
+            style.append(line + "\n");
         }
 
         setStyleSheet(style);