Esempio n. 1
0
        protected override void InsertFromMimeData(Qyoto.QMimeData source)
        {
            var cursor = base.TextCursor();

            if (source.HasImage())
            {
                var image     = QPixmap.FromImage((QImage)source.ImageData());
                var document  = base.Document();
                var imageName = Guid.NewGuid().ToString();
                document.AddResource((int)QTextDocument.ResourceType.ImageResource, new QUrl(imageName), image);
                cursor.InsertImage(imageName);
            }
            else if (source.HasUrls())
            {
                var magic = new Magic(true);
                foreach (var url in source.Urls())
                {
                    if (url.Scheme() == "file")
                    {
                        string fileName = url.Path();
                        if (File.Exists(fileName))
                        {
                            string mimeType = magic.Lookup(url.Path());
                            if (mimeType.StartsWith("image/"))
                            {
                                // FIXME: If image is over a certain size, send as file transfer rather
                                // than encoded inline.
                                cursor.InsertHtml(String.Format("<img src=\"{0}\" />", fileName));
                            }
                            else
                            {
                                // FIXME: Generate and insert an image representing a file.
                                Console.WriteLine("File Transfer: " + fileName);
                            }
                        }
                        else
                        {
                            // FIXME: Support "sending" directories?
                            cursor.InsertText(url.ToString());
                        }
                    }
                    else if (url.Scheme() == "http" || url.Scheme() == "https")
                    {
                        cursor.InsertHtml(String.Format("<a href=\"{0}\">{0}</a>", url.ToString()));
                    }
                    else
                    {
                        cursor.InsertText(url.ToString());
                    }
                }
            }
            else
            {
                base.InsertFromMimeData(source);
            }
        }
Esempio n. 2
0
 protected override bool CanInsertFromMimeData(Qyoto.QMimeData source)
 {
     if (source.HasImage())
     {
         return(true);
     }
     else
     {
         return(base.CanInsertFromMimeData(source));
     }
 }
Esempio n. 3
0
 public void SetMimeData(QMimeData data)
 {
     interceptor.Invoke("setMimeData#", "setMimeData(QMimeData*)", typeof(void), typeof(QMimeData), data);
 }
Esempio n. 4
0
File: KUrl.cs Progetto: KDE/kimono
 public void PopulateMimeData(QMimeData mimeData, Dictionary<string, string> metaData)
 {
     interceptor.Invoke("populateMimeData#?", "populateMimeData(QMimeData*, const QMap<QString,QString>&) const", typeof(void), typeof(QMimeData), mimeData, typeof(Dictionary<string, string>), metaData);
 }
Esempio n. 5
0
 /// <remarks>
 ///  Extract a list of bookmarks from the contents of <code>mimeData.</code>
 ///  Decoding will fail if <code>mimeData</code> does not contain any bookmarks.
 /// <param> name="mimeData" the mime data to extract from; cannot be 0
 /// </param></remarks>        <return> the list of bookmarks
 ///  @note those bookmarks are valid QDomElements, but their parent QDomDocument
 ///  is already deleted, do not use ownerDocument()
 ///          </return>
 ///         <short>    Extract a list of bookmarks from the contents of <code>mimeData.</code></short>
 public static KBookmark.List FromMimeData(QMimeData mimeData)
 {
     return (KBookmark.List) staticInterceptor.Invoke("fromMimeData#", "fromMimeData(const QMimeData*)", typeof(KBookmark.List), typeof(QMimeData), mimeData);
 }
Esempio n. 6
0
 protected virtual void InsertFromMimeData(QMimeData source)
 {
     interceptor.Invoke("insertFromMimeData#", "insertFromMimeData(const QMimeData*)", typeof(void), typeof(QMimeData), source);
 }
Esempio n. 7
0
 protected virtual void InsertFromMimeData(QMimeData source)
 {
     interceptor.Invoke("insertFromMimeData#", "insertFromMimeData(const QMimeData*)", typeof(void), typeof(QMimeData), source);
 }
Esempio n. 8
0
 public override bool DropMimeData(QMimeData data, Qt.DropAction action, int row, int column, QModelIndex parent)
 {
     return (bool) interceptor.Invoke("dropMimeData#$$$#", "dropMimeData(const QMimeData*, Qt::DropAction, int, int, const QModelIndex&)", typeof(bool), typeof(QMimeData), data, typeof(Qt.DropAction), action, typeof(int), row, typeof(int), column, typeof(QModelIndex), parent);
 }
Esempio n. 9
0
 public QDropEvent(QPoint pos, uint actions, QMimeData data, uint buttons, uint modifiers) : this((Type)null)
 {
     CreateProxy();
     interceptor.Invoke("QDropEvent#$#$$", "QDropEvent(const QPoint&, Qt::DropActions, const QMimeData*, Qt::MouseButtons, Qt::KeyboardModifiers)", typeof(void), typeof(QPoint), pos, typeof(uint), actions, typeof(QMimeData), data, typeof(uint), buttons, typeof(uint), modifiers);
 }
Esempio n. 10
0
 /// <remarks>
 ///  Sets the color and text representation fields for the specified color in the mimedata object:
 ///  application/x-color and text/plain types are set
 ///      </remarks>        <short>    Sets the color and text representation fields for the specified color in the mimedata object:  application/x-color and text/plain types are set      </short>
 public static void PopulateMimeData(QMimeData mimeData, QColor color)
 {
     staticInterceptor.Invoke("populateMimeData##", "populateMimeData(QMimeData*, const QColor&)", typeof(void), typeof(QMimeData), mimeData, typeof(QColor), color);
 }
Esempio n. 11
0
 /// <remarks>
 ///  Decodes the MIME data <code>mimeData</code> and returns the resulting color.
 ///  First tries application/x-color and if that fails, a text/plain entry, which
 ///  represents a color in the format \#hexnumbers. If this fails too,
 ///  an invalid QColor object is returned, use QColor.IsValid() to test it.
 ///      </remarks>        <short>    Decodes the MIME data <code>mimeData</code> and returns the resulting color.</short>
 public static QColor FromMimeData(QMimeData mimeData)
 {
     return (QColor) staticInterceptor.Invoke("fromMimeData#", "fromMimeData(const QMimeData*)", typeof(QColor), typeof(QMimeData), mimeData);
 }
Esempio n. 12
0
 protected virtual bool DropMimeData(QTreeWidgetItem parent, int index, QMimeData data, Qt.DropAction action)
 {
     return (bool) interceptor.Invoke("dropMimeData#$#$", "dropMimeData(QTreeWidgetItem*, int, const QMimeData*, Qt::DropAction)", typeof(bool), typeof(QTreeWidgetItem), parent, typeof(int), index, typeof(QMimeData), data, typeof(Qt.DropAction), action);
 }
Esempio n. 13
0
File: KIO.cs Progetto: KDE/kimono
 public static KIO.CopyJob PasteMimeSource(QMimeData data, KUrl destURL, string dialogText, QWidget widget)
 {
     return (KIO.CopyJob) staticInterceptor.Invoke("pasteMimeSource##$#", "pasteMimeSource(const QMimeData*, const KUrl&, const QString&, QWidget*)", typeof(KIO.CopyJob), typeof(QMimeData), data, typeof(KUrl), destURL, typeof(string), dialogText, typeof(QWidget), widget);
 }
Esempio n. 14
0
 protected virtual bool DropMimeData(int row, int column, QMimeData data, Qt.DropAction action)
 {
     return((bool)interceptor.Invoke("dropMimeData$$#$", "dropMimeData(int, int, const QMimeData*, Qt::DropAction)", typeof(bool), typeof(int), row, typeof(int), column, typeof(QMimeData), data, typeof(Qt.DropAction), action));
 }
Esempio n. 15
0
 protected virtual bool DropMimeData(QTreeWidgetItem parent, int index, QMimeData data, Qt.DropAction action)
 {
     return((bool)interceptor.Invoke("dropMimeData#$#$", "dropMimeData(QTreeWidgetItem*, int, const QMimeData*, Qt::DropAction)", typeof(bool), typeof(QTreeWidgetItem), parent, typeof(int), index, typeof(QMimeData), data, typeof(Qt.DropAction), action));
 }
 public bool DropMimeData(Phonon.ObjectDescriptionType type, QMimeData data, Qt.DropAction action, int row, int column, QModelIndex parent)
 {
     return (bool) interceptor.Invoke("dropMimeData$#$$$#", "dropMimeData(Phonon::ObjectDescriptionType, const QMimeData*, Qt::DropAction, int, int, const QModelIndex&)", typeof(bool), typeof(Phonon.ObjectDescriptionType), type, typeof(QMimeData), data, typeof(Qt.DropAction), action, typeof(int), row, typeof(int), column, typeof(QModelIndex), parent);
 }
Esempio n. 17
0
 protected List <QTreeWidgetItem> Items(QMimeData data)
 {
     return((List <QTreeWidgetItem>)interceptor.Invoke("items#", "items(const QMimeData*) const", typeof(List <QTreeWidgetItem>), typeof(QMimeData), data));
 }
Esempio n. 18
0
 public void SetMimeData(QMimeData data, QClipboard.Mode mode)
 {
     interceptor.Invoke("setMimeData#$", "setMimeData(QMimeData*, QClipboard::Mode)", typeof(void), typeof(QMimeData), data, typeof(QClipboard.Mode), mode);
 }
Esempio n. 19
0
 public override bool DropMimeData(QMimeData data, Qt.DropAction action, int row, int column, QModelIndex parent)
 {
     return((bool)interceptor.Invoke("dropMimeData#$$$#", "dropMimeData(const QMimeData*, Qt::DropAction, int, int, const QModelIndex&)", typeof(bool), typeof(QMimeData), data, typeof(Qt.DropAction), action, typeof(int), row, typeof(int), column, typeof(QModelIndex), parent));
 }
Esempio n. 20
0
File: QDrag.cs Progetto: KDE/qyoto
 public void SetMimeData(QMimeData data)
 {
     interceptor.Invoke("setMimeData#", "setMimeData(QMimeData*)", typeof(void), typeof(QMimeData), data);
 }
Esempio n. 21
0
 protected virtual bool CanInsertFromMimeData(QMimeData source)
 {
     return (bool) interceptor.Invoke("canInsertFromMimeData#", "canInsertFromMimeData(const QMimeData*) const", typeof(bool), typeof(QMimeData), source);
 }
Esempio n. 22
0
 public QDropEvent(QPoint pos, uint actions, QMimeData data, uint buttons, uint modifiers)
     : this((Type) null)
 {
     CreateProxy();
     interceptor.Invoke("QDropEvent#$#$$", "QDropEvent(const QPoint&, Qt::DropActions, const QMimeData*, Qt::MouseButtons, Qt::KeyboardModifiers)", typeof(void), typeof(QPoint), pos, typeof(uint), actions, typeof(QMimeData), data, typeof(uint), buttons, typeof(uint), modifiers);
 }
Esempio n. 23
0
 protected virtual bool CanInsertFromMimeData(QMimeData source)
 {
     return((bool)interceptor.Invoke("canInsertFromMimeData#", "canInsertFromMimeData(const QMimeData*) const", typeof(bool), typeof(QMimeData), source));
 }
Esempio n. 24
0
 protected virtual bool DropMimeData(int row, int column, QMimeData data, Qt.DropAction action)
 {
     return (bool) interceptor.Invoke("dropMimeData$$#$", "dropMimeData(int, int, const QMimeData*, Qt::DropAction)", typeof(bool), typeof(int), row, typeof(int), column, typeof(QMimeData), data, typeof(Qt.DropAction), action);
 }
Esempio n. 25
0
 /// <remarks>
 ///  Return true if <code>mimeData</code> contains bookmarks
 ///          </remarks>        <short>    Return true if <code>mimeData</code> contains bookmarks          </short>
 public static bool CanDecode(QMimeData mimeData)
 {
     return (bool) staticInterceptor.Invoke("canDecode#", "canDecode(const QMimeData*)", typeof(bool), typeof(QMimeData), mimeData);
 }
Esempio n. 26
0
 protected List<QTableWidgetItem> Items(QMimeData data)
 {
     return (List<QTableWidgetItem>) interceptor.Invoke("items#", "items(const QMimeData*) const", typeof(List<QTableWidgetItem>), typeof(QMimeData), data);
 }
Esempio n. 27
0
 /// <remarks>
 ///  Adds this list of bookmark into the given QMimeData.
 /// <param> name="mimeData" the QMimeData instance used to drag or copy this bookmark
 ///          </param></remarks>        <short>    Adds this list of bookmark into the given QMimeData.</short>
 public void PopulateMimeData(QMimeData mimeData)
 {
     interceptor.Invoke("populateMimeData#", "populateMimeData(QMimeData*) const", typeof(void), typeof(QMimeData), mimeData);
 }
Esempio n. 28
0
File: KUrl.cs Progetto: KDE/kimono
 /// <remarks>
 ///  Adds URL data into the given QMimeData.
 ///  By default, populateMimeData also exports the URL as plain text, for e.g. dropping
 ///  onto a text editor.
 ///  But in some cases this might not be wanted, e.g. if adding other mime data
 ///  which provides better plain text data.
 ///  WARNING: do not call this method multiple times, use KUrl.List.PopulateMimeData instead.
 /// <param> name="mimeData" the QMimeData instance used to drag or copy this URL
 /// </param><param> name="metaData" KIO metadata shipped in the mime data, which is used for instance to
 ///  set a correct HTTP referrer (some websites require it for downloading e.g. an image)
 /// </param><param> name="flags" set NoTextExport to prevent setting plain/text data into <code>mimeData</code>
 ///  In such a case, setExportAsText( false ) should be called.
 ///    </param></remarks>        <short>    Adds URL data into the given QMimeData.</short>
 public void PopulateMimeData(QMimeData mimeData, Dictionary<string, string> metaData, KUrl.MimeDataFlags flags)
 {
     interceptor.Invoke("populateMimeData#?$", "populateMimeData(QMimeData*, const QMap<QString,QString>&, KUrl::MimeDataFlags) const", typeof(void), typeof(QMimeData), mimeData, typeof(Dictionary<string, string>), metaData, typeof(KUrl.MimeDataFlags), flags);
 }