Examples of QUrl


Examples of com.trolltech.qt.core.QUrl

  private void emailNote() {
        if (Desktop.isDesktopSupported()) {
            Desktop desktop = Desktop.getDesktop();
           
            String text2 = browser.getContentsToEmail();
            QUrl url = new QUrl("mailto:");
            url.addQueryItem("subject", browser.getTitle());
            url.addQueryItem("body", text2);
            QDesktopServices.openUrl(url);
        }
    }
View Full Code Here

Examples of com.trolltech.qt.core.QUrl

   
    String url = urlText.text();
    if (!url.toLowerCase().startsWith(tr("http://")))
      url = tr("http://") +url;
   
        if (!QDesktopServices.openUrl(new QUrl(url))) {
          logger.log(logger.LOW, "Error opening file :" +url);
        }
  }
View Full Code Here

Examples of com.trolltech.qt.core.QUrl

  private void openFile() {
    logger.log(logger.EXTREME, "Starting openFile()");
    File fileHandle = new File(selectedFile);
    URI fileURL = fileHandle.toURI();
    String localURL = fileURL.toString();
    QUrl url = new QUrl(localURL);
    QFile file = new QFile(selectedFile);
   
    logger.log(logger.EXTREME, "Adding to fileWatcher:"+file.fileName());
    fileWatcher.addPath(file.fileName());
       
View Full Code Here

Examples of com.trolltech.qt.core.QUrl

    logger.log(logger.EXTREME, "Sending request to codecogs --> " + url);
    QNetworkAccessManager manager = new QNetworkAccessManager(this);
    manager.finished.connect(this, "insertLatexImageReady(QNetworkReply)");
    unblockTime = new GregorianCalendar().getTimeInMillis()+5000;
    awaitingHttpResponse = true;
    manager.get(new QNetworkRequest(new QUrl(url)));
  }
View Full Code Here

Examples of com.trolltech.qt.core.QUrl

    unblockTime = -1;
    if (!awaitingHttpResponse)
      return;
   
    awaitingHttpResponse = false;
    QUrl replyUrl = reply.url();   
    QByteArray image = reply.readAll();
    reply.close();
    logger.log(logger.EXTREME, "New image size: " +image.size());

    Resource newRes = null;
    QFile tfile;
    String path;
    if (latexGuid == null) {
      logger.log(logger.EXTREME, "Creating temporary gif");     
      path = Global.getFileManager().getResDirPath("latex-temp.gif");
      tfile = new QFile(path);
      tfile.open(new QIODevice.OpenMode(QIODevice.OpenModeFlag.WriteOnly));
      logger.log(logger.EXTREME, "File Open: " +tfile.errorString());
      tfile.write(image);
      logger.log(logger.EXTREME, "Bytes writtes: "+tfile.size());
      tfile.close();
      logger.log(logger.EXTREME, "Creating resource");
      int sequence = 0;
      if (currentNote.getResources() != null || currentNote.getResources().size() > 0)
        sequence = currentNote.getResources().size();
      newRes = createResource(path,sequence ,"image/gif", false);
      QImage pix = new QImage();
      pix.loadFromData(image);
      newRes.setHeight(new Integer(pix.height()).shortValue());
      newRes.setWidth(new Integer(pix.width()).shortValue());
      logger.log(logger.EXTREME, "Renaming temporary file to " +newRes.getGuid()+".gif");
      path = Global.getFileManager().getResDirPath(newRes.getGuid()+".gif");
      tfile.rename(path);
    } else {
      newRes = conn.getNoteTable().noteResourceTable.getNoteResource(latexGuid, false);
      path = Global.getFileManager().getResDirPath(newRes.getGuid()+".gif");
      tfile = new QFile(path);
      tfile.open(new QIODevice.OpenMode(QIODevice.OpenModeFlag.WriteOnly));
      tfile.write(image);
      tfile.close();
      newRes.getData().setBody(image.toByteArray());
      // Calculate the new hash value
        MessageDigest md;

        logger.log(logger.EXTREME, "Generating MD5");
        try {
        md = MessageDigest.getInstance("MD5");
          md.update(image.toByteArray());
          byte[] hash = md.digest();
          newRes.getData().setBodyHash(hash);
      } catch (NoSuchAlgorithmException e) {
        e.printStackTrace();
      }
      QImage pix = new QImage();
      pix.loadFromData(image);
      newRes.setHeight(new Integer(pix.height()).shortValue());
      newRes.setWidth(new Integer(pix.width()).shortValue());
      conn.getNoteTable().noteResourceTable.updateNoteResource(newRes, true);
    }

    logger.log(logger.EXTREME, "Setting source: " +replyUrl.toString());
    newRes.getAttributes().setSourceURL(replyUrl.toString());
    conn.getNoteTable().noteResourceTable.updateNoteSourceUrl(newRes.getGuid(), replyUrl.toString(), true);
   
    for(int i=0; i<currentNote.getResourcesSize(); i++) {
      if (currentNote.getResources().get(i).getGuid().equals(newRes.getGuid())) {
        currentNote.getResources().remove(i);
        i=currentNote.getResourcesSize();
      }
    }
    currentNote.getResources().add(newRes);
   

    // do the actual insert into the note.  We only do this on new formulas. 
    if (latexGuid == null) {
      StringBuffer buffer = new StringBuffer(100);
      String formula = replyUrl.toString().toLowerCase().replace("http://latex.codecogs.com/gif.latex?", "");
      buffer.append("<a href=\"latex://"+path.replace("\\", "/")+"\" title=\""+formula+"\""
          +"><img src=\"");
      buffer.append(path.replace("\\", "/"));
      buffer.append("\" en-tag=\"en-latex\" type=\"image/gif\""
        +" hash=\""+Global.byteArrayToHexString(newRes.getData().getBodyHash()) +"\""
View Full Code Here

Examples of com.trolltech.qt.core.QUrl

    String whichOS = System.getProperty("os.name");
    if (whichOS.contains("Windows"))
      url = url.replace("file:///", "");
    else
      url = url.replace("file://", "");
    String urlTest = new QUrl(url).toLocalFile();
    logger.log(logger.EXTREME, "File URL toLocalFile():" +urlTest);
    urlTest = url;
    if (!urlTest.equals(""))
      url = urlTest;
//    url = url.replace("/", File.separator);
View Full Code Here

Examples of com.trolltech.qt.core.QUrl

      currentNote.getAttributes().setLongitude(0.0);
      currentNote.getAttributes().setLatitude(0.0);
    }
   
    if (index == 3 || index == 0) {
      QDesktopServices.openUrl(new QUrl("http://maps.google.com/maps?z=6&q="+currentNote.getAttributes().getLatitude() +"," +currentNote.getAttributes().getLongitude()));
    }
  }
View Full Code Here

Examples of com.trolltech.qt.core.QUrl

  public void checkForUpdates() {
    // Send off thread to check for a new version
    versionChecker = new QNetworkAccessManager(this);
    versionChecker.finished.connect(this, "upgradeFileRead(QNetworkReply)");
    QNetworkRequest request = new QNetworkRequest();
    request.setUrl(new QUrl(Global.getUpdatesAvailableUrl()));
    versionChecker.get(request);
  }
View Full Code Here

Examples of com.trolltech.qt.core.QUrl

     
        if (Desktop.isDesktopSupported()) {
            Desktop desktop = Desktop.getDesktop();
           
            String text2 = browserWindow.getContentsToEmail();
            QUrl url = new QUrl("mailto:");
            url.addQueryItem("subject", currentNote.getTitle());
//            url.addQueryItem("body", QUrl.toPercentEncoding(text2).toString());
            url.addQueryItem("body", text2);
            QDesktopServices.openUrl(url);
        }
/*           
           
            if (desktop.isSupported(Desktop.Action.MAIL)) {
View Full Code Here

Examples of com.trolltech.qt.core.QUrl

             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
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.