/* ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- */ void CShowString::HandleViewCommandL(TInt aCommand) { switch(aCommand) { case ESSCopyClipBoard: if(iString) { CClipboard* cb = CClipboard::NewForWritingLC(CCoeEnv::Static()->FsSession()); cb->StreamDictionary().At(KClipboardUidTypePlainText); CPlainText* BPlainText = CPlainText::NewL(); CleanupStack::PushL(BPlainText); BPlainText->InsertL(0,iString->Des()); BPlainText->CopyToStoreL(cb->Store(),cb->StreamDictionary(),0,BPlainText->DocumentLength()); CleanupStack::PopAndDestroy(); // CBPlainText cb->CommitL(); CleanupStack::PopAndDestroy(); // cb } break; }; }
void writeToSymbianStoreLX(const QMimeData* aData, CClipboard* clipboard) { // This function both leaves and throws exceptions. There must be no destructor // dependencies between cleanup styles, and no cleanup stack dependencies on stacked objects. if (aData->hasText()) { CPlainText* text = CPlainText::NewL(); CleanupStack::PushL(text); TPtrC textPtr(qt_QString2TPtrC(aData->text())); text->InsertL(KPlainTextBegin, textPtr); text->CopyToStoreL(clipboard->Store(), clipboard->StreamDictionary(), KPlainTextBegin, textPtr.Length()); CleanupStack::PopAndDestroy(text); } }
void readSymbianStoreLX(QMimeData* aData, CClipboard* clipboard) { // This function both leaves and throws exceptions. There must be no destructor // dependencies between cleanup styles, and no cleanup stack dependencies on stacked objects. CPlainText* text = CPlainText::NewL(); CleanupStack::PushL(text); TInt dataLength = text->PasteFromStoreL(clipboard->Store(), clipboard->StreamDictionary(), KPlainTextBegin); if (dataLength == 0) { User::Leave(KErrNotFound); } HBufC* hBuf = HBufC::NewL(dataLength); TPtr buf = hBuf->Des(); text->Extract(buf, KPlainTextBegin, dataLength); QString string = qt_TDesC2QString(buf); CleanupStack::PopAndDestroy(text); aData->clear(); aData->setText(string); }