Examples of QMimeData


Examples of com.trolltech.qt.core.QMimeData

  //* Action from when a user clicks Copy As URL
  //**************************************************
  @SuppressWarnings("unused")
  private void copyAsUrlClicked() {
    QClipboard clipboard = QApplication.clipboard();
    QMimeData mime = new QMimeData();
    String url;
    mime.setText(currentNoteGuid);
    List<QUrl> urls = new ArrayList<QUrl>();
   
    // Start building the URL
    User user = Global.getUserInformation();

    // Check that we have everything we need
       if ((user.getShardId().equals("") || user.getId() == 0) && !Global.bypassSynchronizationWarning()) {
         SynchronizationRequiredWarning warning = new SynchronizationRequiredWarning(this);
         warning.exec();
         if (!warning.neverSynchronize())
           return;
         else {
           Global.setBypassSynchronizationWarning(true);
           user.setShardId("s0");
           user.setId(0);
        
       }

   
    // Start building a list of URLs based upon the selected notes
      noteTableView.showColumn(Global.noteTableGuidPosition);
     
      List<QModelIndex> selections = noteTableView.selectionModel().selectedRows();
      if (!Global.isColumnVisible("guid"))
        noteTableView.hideColumn(Global.noteTableGuidPosition);

       // Check that the note is either synchronized, or in a local notebook
       for (int i=0; i<selections.size(); i++) {
         QModelIndex index;
         int row = selections.get(i).row();
        index = noteTableView.proxyModel.index(row, Global.noteTableGuidPosition);
        SortedMap<Integer, Object> ix = noteTableView.proxyModel.itemData(index);
           String selectedGuid = (String)ix.values().toArray()[0];
          
           Note n = conn.getNoteTable().getNote(selectedGuid, false, false, false, false, false);
           if (n.getUpdateSequenceNum() == 0 && !conn.getNotebookTable().isNotebookLocal(n.getNotebookGuid())) {
             QMessageBox.critical(this, tr("Please Synchronize") ,tr("Please either synchronize or move any " +
                 "new notes to a local notebook."));
             return;
           }
       }

       // Start building the URLs
      for (int i=0; i<selections.size(); i++) {
        QModelIndex index;
         int row = selections.get(i).row();
        index = noteTableView.proxyModel.index(row, Global.noteTableGuidPosition);
        SortedMap<Integer, Object> ix = noteTableView.proxyModel.itemData(index);
           String selectedGuid = (String)ix.values().toArray()[0];
           mime.setText(selectedGuid);
   
           String lid;
           String gid;
           Note selectedNote = conn.getNoteTable().getNote(selectedGuid, false, false, false, false, false);
           if (selectedNote.getUpdateSequenceNum() > 0) {
             gid = selectedGuid;
             lid = selectedGuid;
           } else {
             gid = "00000000-0000-0000-0000-000000000000";
             lid = selectedGuid;
           }
           url = new String("evernote://///view/") + new String(user.getId() + "/" +user.getShardId() +"/"
               +gid+"/"+lid +"/");
           urls.add(new QUrl(url));
      }
    mime.setUrls(urls);
    clipboard.setMimeData(mime);
  }
View Full Code Here

Examples of com.trolltech.qt.core.QMimeData

    if (forceTextPaste) {
      pasteWithoutFormattingClicked();
      return;
    }
    QClipboard clipboard = QApplication.clipboard();
    QMimeData mime = clipboard.mimeData();

    if (mime.hasImage()) {
      logger.log(logger.EXTREME, "Image paste found");
      browser.setFocus();
      insertImage(mime);
      browser.setFocus();
      return;
    }

    if (mime.hasUrls()) {
      logger.log(logger.EXTREME, "URL paste found");
      if (mime.text().startsWith("evernote:")) {
        handleNoteLink(mime);
      } else {
        handleUrls(mime);
        browser.setFocus();
      }
      return;
    }
   
    String text = mime.html();
    if (text.contains("en-tag") && mime.hasHtml()) {
      logger.log(logger.EXTREME, "Intra-note paste found");
      text = fixInternotePaste(text);
      mime.setHtml(text);
      clipboard.setMimeData(mime);
    }

    logger.log(logger.EXTREME, "Final paste choice encountered");
    browser.page().triggerAction(WebAction.Paste);
View Full Code Here

Examples of com.trolltech.qt.core.QMimeData

  // Paste text without formatting
  private void pasteWithoutFormattingClicked() {
    logger.log(logger.EXTREME, "Paste without format clipped");
    QClipboard clipboard = QApplication.clipboard();
    QMimeData mime = clipboard.mimeData();
    if (!mime.hasText())
      return;
    String text = mime.text();
    clipboard.clear();
    clipboard.setText(text, Mode.Clipboard);
    browser.page().triggerAction(WebAction.Paste);

    // This is done because pasting into an encryption block
View Full Code Here

Examples of com.trolltech.qt.core.QMimeData

 
  @Override
  public void dropEvent(QDropEvent e) {
    setFocus();
    QMimeData mime = e.mimeData();
    parent.handleUrls(mime);
    parent.contentChanged();
//    triggerPageAction(WebAction.Reload);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.