[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kmail-devel
Subject:    attachment execution
From:       Daniel Naber <dnaber () mini ! gt ! owl ! de>
Date:       2000-05-29 22:12:11
[Download RAW message or body]

Hi,

I just started implementing better attachment handling. I'm not very far 
yet, the idea is this (see code below, it belongs to 
KMReaderWin::slotAtmOpen()): If there is a know service for an attachment,
offer to open the attachment with that. If there's none, open the "open 
with" dialog. Quite simple, but I thought I had to do something... (I hope 
I can continue with this tomorrow).

I'll send another mail with some attachments so we can better test this.

Regards
 Daniel


  QString mimetype = KMimeType::findByURL(KURL(fileName))->name();
  KService::Ptr offer = 
	KServiceTypeProfile::preferredService( mimetype, true /*need app*/ );
  if ( !offer ) {
    printf("** fixme: open with...\n");
  } else {
    // fixme: default to "Cancel":
    QString service = offer->name();
    int choice = KMessageBox::questionYesNo(this, 
	"Open attachment using'" + service + "'?", "Open Attachment?", 
	"Yes", "Cancel");
    if( choice == KMessageBox::Yes ) {
      KURL::List *lst;
      lst = new KURL::List();
      KRun::run( *offer, *lst );
    } else {
      printf("** offer save?? at least don't exec....\n");
    }
  }

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic