Package com.trolltech.qt.core

Examples of com.trolltech.qt.core.QFile.open()


      }
   
    lastError = 0;
    errorMessage = "";
    QFile xmlFile = new QFile(filename);
    if (!xmlFile.open(QIODevice.OpenModeFlag.WriteOnly, QIODevice.OpenModeFlag.Truncate)) {
      lastError = 16;
      errorMessage = "Cannot open file.";
    }
     
    writer = new QXmlStreamWriter(xmlFile)
View Full Code Here


    errorMessage = "";
       
    lastError = 0;
    errorMessage = "";
    QFile xmlFile = new QFile(fileName);
    if (!xmlFile.open(QIODevice.OpenModeFlag.ReadOnly)) {
      lastError = 16;
      errorMessage = "Cannot open file.";
    }
     
    reader = new QXmlStreamReader(xmlFile)
View Full Code Here

         if (r==null || r.getData() == null || r.getData().getBody().length == 0) {
           resourceError = true;
           readOnly = true;
         }
         if (r!= null && r.getData() != null && r.getData().getBody().length > 0) {
         tfile.open(new QIODevice.OpenMode(QIODevice.OpenModeFlag.WriteOnly));
         QByteArray binData = new QByteArray(r.getData().getBody());
        tfile.write(binData);
         tfile.close();
        
         // If we have recognition text, outline it
View Full Code Here

      // We have pictures, so append them to the page.  This really isn't proper since
      // we leave the en-media tag in place, but since we can't edit the page it doesn't
      // hurt anything.
      for (int i=0; i<data.size(); i++) {
          QFile f = new QFile(Global.getFileManager().getResDirPath(resGuid + new Integer(i).toString()+".png"));
        f.open(OpenModeFlag.WriteOnly);
        f.write(data.get(i));
        f.close();
        QDomElement newImage = doc.createElement("img");
        newImage.setAttribute("src", QUrl.fromLocalFile(f.fileName()).toString());
        enmedia.appendChild(newImage);
View Full Code Here

          else
            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());
View Full Code Here

    // If a user default.qss doesn't exist, we use the one shipped with NeverNote
    if (!file.exists()) {
      fileName = Global.getFileManager().getQssDirPath(styleSheetName);
      file = new QFile(fileName);
    }
    file.open(OpenModeFlag.ReadOnly);
    String styleSheet = file.readAll().toString();
    file.close();
    setStyleSheet(styleSheet);
  }
  // Save column positions for the next time
View Full Code Here

    QHBoxLayout layout = new QHBoxLayout();
    QTextEdit textBox = new QTextEdit();
    layout.addWidget(textBox);
    textBox.setReadOnly(true);
    QFile file = new QFile(Global.getFileManager().getProgramDirPath("release.txt"));
    if (!file.open(new QIODevice.OpenMode(QIODevice.OpenModeFlag.ReadOnly,
                QIODevice.OpenModeFlag.Text)))
      return;
    textBox.setText(file.readAll().toString());
    file.close();
    dialog.setWindowTitle(tr("Release Notes"));
View Full Code Here

    if (pos > -1) {
      guid = name.substring(0, pos);
    }
   
    QFile file = new QFile(fileName);
        if (!file.open(new QIODevice.OpenMode(QIODevice.OpenModeFlag.ReadOnly))) {
          // If we can't get to the file, it is probably locked.  We'll try again later.
          logger.log(logger.LOW, "Unable to save externally edited file.  Saving for later.");
          externalFiles.add(fileName);
          return;
    }
View Full Code Here

          finally {
              iStream.close();
              fOut.close();
          }
          QFile tempFile = new QFile(temp.getAbsoluteFile().toString());
          tempFile.open(OpenModeFlag.ReadOnly);
          QByteArray data = tempFile.readAll();
          tempFile.close();
          tempFile.remove();
          return data;
    }
View Full Code Here

        else
          fileName = res.getGuid()+"."+type;
        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;
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.