Package com.trolltech.qt.core

Examples of com.trolltech.qt.core.QDataStream


            fileName = res.getGuid()+".pdf";
          QFile file = new QFile(fileManager.getResDirPath(fileName));
              QFile.OpenMode mode = new QFile.OpenMode();
              mode.set(QFile.OpenModeFlag.WriteOnly);
              file.open(mode);
              QDataStream out = new QDataStream(file);
              Resource resBinary = conn.getNoteTable().noteResourceTable.getNoteResource(res.getGuid(), true);
          QByteArray binData = new QByteArray(resBinary.getData().getBody());
          resBinary = null;
              out.writeBytes(binData.toByteArray());
              file.close();
              PDFPreview pdfPreview = new PDFPreview();
          goodPreview = pdfPreview.setupPreview(file.fileName(), appl,0);
          if (goodPreview) {
            QDomElement span = doc.createElement("span");
View Full Code Here


        QFile file = new QFile(Global.getFileManager().getResDirPath(fileName));
            QFile.OpenMode mode = new QFile.OpenMode();
            mode.set(QFile.OpenModeFlag.WriteOnly);
            boolean openResult = file.open(mode);
        logger.log(logger.EXTREME, "File opened:" +openResult);
            QDataStream out = new QDataStream(file);
            Resource resBinary = conn.getNoteTable().noteResourceTable.getNoteResource(res.getGuid(), true);
        QByteArray binData = new QByteArray(resBinary.getData().getBody());
        resBinary = null;
        logger.log(logger.EXTREME, "Writing resource");
            out.writeBytes(binData.toByteArray());
            file.close();
             
            String whichOS = System.getProperty("os.name");
        if (whichOS.contains("Windows"))
              url.setUrl("file:///"+file.fileName());
            else
              url.setUrl("file://"+file.fileName());
     //       fileWatcher.removePath(file.fileName());
        logger.log(logger.EXTREME, "Adding file watcher " +file.fileName());
        fileWatcher.addPath(file.fileName());
           
            // If we can't open it, then prompt the user to save it.
            if (!QDesktopServices.openUrl(url)) {
          logger.log(logger.EXTREME, "We can't handle this.  Where do we put it?");
              QFileDialog dialog = new QFileDialog();
              dialog.show();
              if (dialog.exec()!=0) {
                List<String> fileNames = dialog.selectedFiles(); //gets all selected filenames
                if (fileNames.size() == 0)
                  return;
                String sf = fileNames.get(0);
                QFile saveFile = new QFile(sf);
                mode.set(QFile.OpenModeFlag.WriteOnly);
                saveFile.open(mode);
                QDataStream saveOut = new QDataStream(saveFile);
                saveOut.writeBytes(binData.toByteArray());
                saveFile.close();
                return;
              }
        }
      }
View Full Code Here

          fileName = newRes.getGuid()+".pdf";
        QFile file = new QFile(Global.getFileManager().getResDirPath(fileName));
            QFile.OpenMode mode = new QFile.OpenMode();
            mode.set(QFile.OpenModeFlag.WriteOnly);
            file.open(mode);
            QDataStream out = new QDataStream(file);
//            Resource resBinary = conn.getNoteTable().noteResourceTable.getNoteResource(newRes.getGuid(), true);
        QByteArray binData = new QByteArray(newRes.getData().getBody());
//        resBinary = null;
            out.writeBytes(binData.toByteArray());
            file.close();

        PDFPreview pdfPreview = new PDFPreview();
        if (pdfPreview.setupPreview(Global.getFileManager().getResDirPath(fileName), "pdf",0)) {
              imageURL = file.fileName() + ".png";
View Full Code Here

      Resource resBinary = conn.getNoteTable().noteResourceTable.getNoteResource(guid, true);
      QFile saveFile = new QFile(fd.selectedFiles().get(0));
      QFile.OpenMode mode = new QFile.OpenMode();
      mode.set(QFile.OpenModeFlag.WriteOnly);
      saveFile.open(mode);
      QDataStream saveOut = new QDataStream(saveFile);
      QByteArray binData = new QByteArray(resBinary.getData().getBody());
      saveOut.writeBytes(binData.toByteArray());
      saveFile.close();

    }
  }
View Full Code Here

      String fileName = fd.selectedFiles().get(0);
      QFile saveFile = new QFile(fileName);
      QFile.OpenMode mode = new QFile.OpenMode();
      mode.set(QFile.OpenModeFlag.WriteOnly);
      saveFile.open(mode);
      QDataStream saveOut = new QDataStream(saveFile);
      QByteArray binData = new QByteArray(resBinary.getData().getBody());
      saveOut.writeBytes(binData.toByteArray());
      saveFile.close();
    }
  }
View Full Code Here

TOP

Related Classes of com.trolltech.qt.core.QDataStream

Copyright © 2018 www.massapicom. 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.