Package com.trolltech.qt.core

Examples of com.trolltech.qt.core.QByteArray


    if (event.mimeData().hasFormat("application/x-nevernote-note")) {
      event.accept();
      return;
    }
    if (event.source() == this) {
      event.mimeData().setData("application/x-nevernote-notebook", new QByteArray(currentItem().text(2)));
      List<QTreeWidgetItem> selected = selectedItems();
      for (int i=0; i<selected.size(); i++) {
        if (selected.get(i).text(2).equalsIgnoreCase("STACK") ||
          selected.get(i).text(2).equals("")) {
            event.ignore();
View Full Code Here


    }
   
    // This is really dead code.  it is the beginning of logic to create stacks by
    // dragging.
    if (data.hasFormat("application/x-nevernote-notebook")) {
      QByteArray d = data.data("application/x-nevernote-notebook");
      String current = d.toString();
     
      // If dropping to the top level, then remove the stack
      if (parent == null) {
        db.getNotebookTable().clearStack(current);
        return true;
      }
     
      // If trying to drop under the "All notebooks" then ignore
      if (parent.text(2).equals(""))
        return false;
     
     
      // If we are NOT droping directly onto the stack icon
      // we need to find the stack widget
      String stackName;
      QTreeWidgetItem stackItem;
      List<QTreeWidgetItem> currentItems = selectedItems();
      if (!parent.text(2).equalsIgnoreCase("STACK")) {
       
        // If a parent stack exists, then use it.
        if (parent.parent() != null) {
          stackName = parent.parent().text(0);
          stackItem = parent.parent();
        } else {
         
          currentItems.add(parent);
          // If a stack doesn't exist, then we need to create one
          stackName = "New Stack"
          // Find a new stack name that isn't in use
          for (int i=1; i<101; i++) {
            if (stacks.containsKey(stackName))
              stackName = "New Stack(" +new Integer(i).toString() + ")";
            else
              break;
          }
          db.getNotebookTable().setStack(parent.text(2), stackName);
          Qt.Alignment ra = new Qt.Alignment(Qt.AlignmentFlag.AlignRight);
          stackItem = createStackIcon(stackName, ra);
          addTopLevelItem(stackItem);
        }
      } else {
        stackName = parent.text(0);
        stackItem = parent;
      }
     
      List<QTreeWidgetItem> newItems = new ArrayList<QTreeWidgetItem>();
      for (int i=0; i<currentItems.size(); i++) {
        newItems.add(copyTreeItem(currentItems.get(i)));
        currentItems.get(i).setHidden(true);
      }
      db.getNotebookTable().setStack(current, stackName);   
      stackItem.addChildren(newItems);
     
      return true;
    }
   
   
    // If we are dropping a note onto a notebook
    if (data.hasFormat("application/x-nevernote-note")) {
      // If we are dropping onto a read-only notebook, we are done.
      if (db.getNotebookTable().isReadOnly(parent.text(2)))
          return false;
     
      QByteArray d = data.data("application/x-nevernote-note");
      String s = d.toString();
      String noteGuidArray[] = s.split(" ");
      for (String element : noteGuidArray) {
        Note n = db.getNoteTable().getNote(element.trim(), false, false, false, false, true);
       
        // We  need to be sure that...
View Full Code Here

          return;
        }
        buffer.close();
         
    logger.log(logger.EXTREME, "Updating database");
    QByteArray b = buffer.buffer();
    conn.getNoteTable().setThumbnail(guid, b);
    conn.getNoteTable().setThumbnailNeeded(guid, false);
  }
View Full Code Here

      r.setActive(new Boolean(query.valueString(6)))// active
      r.setUpdateSequenceNum(new Integer(query.valueString(7)))// update sequence number
     
      Data d = new Data();
      byte[] h = query.valueString(8).getBytes();    // data hash
      QByteArray hData = new QByteArray(h);
      QByteArray bData = new QByteArray(QByteArray.fromHex(hData));
      d.setBodyHash(bData.toByteArray());
      d.setSize(new Integer(query.valueString(9)));
      r.setData(d);
     
      Data rec = new Data();
      if (query.valueObject(10) != null)
View Full Code Here

          SortedMap<Integer, Object> ix = proxyModel.itemData(index);
            guid.append((String)ix.values().toArray()[0]);
            guid.append(" ");
        }
      }
    event.mimeData().setData("application/x-nevernote-note", new QByteArray(guid.toString()));
    event.accept();
       
  }
View Full Code Here

  // Fix CRLF problem that is on some notes
  private String fixCarriageReturn(String note) {
    if (note == null || !Global.enableCarriageReturnFix)
      return note;
    QByteArray a0Hex = new QByteArray("a0");
    String a0 = QByteArray.fromHex(a0Hex).toString();
    note = note.replace("<div>"+a0+"</div>", "<div>&nbsp;</div>");
    return note.replace("<div/>", "<div>&nbsp;</div>");
  }
View Full Code Here

      logger.log(logger.EXTREME, "Note SQL get thumbail failed: " +query.lastError().toString());
    // Get a list of the notes
    if (query.next())  {
      try {
        if (query.getBlob(0) != null) {
          return new QByteArray(query.getBlob(0));
        }
      } catch (java.lang.IllegalArgumentException e) {
        return null;
      }
    }
View Full Code Here

      logger.log(logger.EXTREME, "Note SQL get thumbail failed: " +query.lastError().toString());
    // Get a list of the notes
    while (query.next())  {
      try {
        if (query.getBlob(1) != null) {
          QByteArray data = new QByteArray(query.getBlob(1));
          QPixmap img = new QPixmap();
          if (img.loadFromData(data)) {
            img = img.scaled(Global.largeThumbnailSize);
            map.put(query.valueString(0), img);
          }
View Full Code Here

    if (!query.exec())
      logger.log(logger.EXTREME, "Error finding tag icon.");
    if (!query.next() || query.getBlob(0) == null)
      return null;
   
    QByteArray blob = new QByteArray(query.getBlob(0));
    QIcon icon = new QIcon(QPixmap.fromImage(QImage.fromData(blob)));
    return icon;
  }
View Full Code Here

          }
          QPixmap p = icon.pixmap(32, 32);
          QImage i = p.toImage();
           i.save(buffer, type.toUpperCase());
           buffer.close();
           QByteArray b = new QByteArray(buffer.buffer());
           if (!b.isNull() && !b.isEmpty())
             query.bindValue(":icon", b.toByteArray());
           else
             return;
    }
    query.bindValue(":guid", guid);
    if (!query.exec())
View Full Code Here

TOP

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

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.