Houston, we have a problem.

Marc Mutz Marc.Mutz at uni-bielefeld.de
Thu Sep 5 22:37:52 BST 2002


On Thursday 05 September 2002 20:31, Waldo Bastian wrote:
<snip>
> this is an architectural cleanup
<snip>

Is it? Or is the intorduction of the command pattern not only a pretext 
to dump the collected changes in one's local folder?

I just "found" this little thing:

kmreadermainwin.cpp:
--BEGIN--
void KMReaderMainWin::slotMsgPopup(KMMessage &aMsg, const KURL &aUrl, 
const QPoint& aPoint)
{
  KPopupMenu * menu = new KPopupMenu;
  mUrl = aUrl;
  mMsg = &aMsg;

  if (!aUrl.isEmpty()) {
    if (aUrl.protocol() == "mailto") {
      // popup on a mailto URL
      menu->insertItem(i18n("Send To..."), this, 
SLOT(slotMailtoCompose()));

      if ( mMsg ) {
        menu->insertItem(i18n("Send Reply To..."), this,
                         SLOT(slotMailtoReply()));
        menu->insertItem(i18n("Forward To..."), this,
                         SLOT(slotMailtoForward()));
        menu->insertSeparator();
      }
      menu->insertItem(i18n("Add to Addressbook"), this,
		       SLOT(slotMailtoAddAddrBook()));
      menu->insertItem(i18n("Open in Addressbook..."), this,
		       SLOT(slotMailtoOpenAddrBook()));
      menu->insertItem(i18n("Copy to Clipboard"), this, 
SLOT(slotUrlCopy()));
		       
    } else {
      // popup on a not-mailto URL
      menu->insertItem(i18n("Open URL..."), this, SLOT(slotUrlOpen()));
      menu->insertItem(i18n("Save Link As..."), this, 
SLOT(slotUrlSave()));
      menu->insertItem(i18n("Copy to Clipboard"), this, 
SLOT(slotUrlCopy()));
    }
  } else {
    // popup somewhere else (i.e., not a URL) on the message

    if (!mMsg) // no message
    {
      delete menu;
      return;
    }

    menu->insertItem( i18n("&Reply..."), this, SLOT(slotReplyToMsg()) );
    menu->insertItem( i18n("Reply &All..."), this, 
SLOT(slotReplyAllToMsg()) );
    menu->insertItem( i18n("Message->","&Forward"), this, 
		      SLOT(slotForwardMsg()) );
    menu->insertItem( i18n("Message->Forward->","As &Attachment..."), 
this, 
		      SLOT(slotForwardAttachedMsg()) );
    menu->insertItem( i18n("Message->Forward->","&Redirect..."), this,
		      SLOT(slotRedirectMsg()) );
    menu->insertItem( i18n("&Bounce..."), this, SLOT(slotBounceMsg()) );
    menu->insertSeparator();

    QPopupMenu* filterMenu = new QPopupMenu(menu);
    filterMenu->insertItem( i18n("Filter on &Subject..."), this,
			    SLOT(slotSubjectFilter()) );
    filterMenu->insertItem( i18n("Filter on &From..."), this,
			    SLOT(slotFromFilter()) );
    filterMenu->insertItem( i18n("Filter on &To..."), this,
			    SLOT(slotToFilter()) );
    
    int fml = filterMenu->insertItem( i18n("Filter on 
Mailing-&List..."), this,
				      SLOT(slotMailingListFilter()) );
    QCString name;
    QString value;
    QString lname = KMMLInfo::name( mMsg, name, value );
    filterMenu->setItemEnabled( fml, !lname.isNull() );
    if ( !lname.isNull() )
      filterMenu->changeItem( fml, i18n( "Filter on Mailing-List %1..." 
).arg( lname ) );
    menu->insertItem( i18n("Create F&ilter"), filterMenu );

    QPopupMenu* copyMenu = new QPopupMenu(menu);
    KMMenuCommand::folderToPopupMenu( false, this, &mMenuToFolder, 
copyMenu );
    menu->insertItem( i18n("&Copy To" ), copyMenu );
    menu->insertSeparator();

    menu->insertItem( i18n("Fixed Font &Widths"), this, 
		      SLOT(slotToggleFixedFont()) );
    menu->insertItem( i18n("&View Source"), this, 
		      SLOT(slotShowMsgSrc()) );
    menu->insertSeparator();

    menu->insertItem( i18n("&Print..."), this, SLOT(slotPrintMsg()) );
    menu->insertItem( i18n("Save &As..."), this, SLOT(slotSaveMsg()) );
  }
  menu->exec(aPoint, 0);
  delete menu;
}
---END---

kmmainwin.cpp:
--BEGIN--
void KMMainWin::slotMsgPopup(KMMessage &aMsg, const KURL &aUrl, const 
QPoint& aPoint)
{
  KPopupMenu * menu = new KPopupMenu;
  updateMessageMenu();

  mMsgCurrent = jumpToMessage(&aMsg); // obsolete?
  mUrlCurrent = aUrl;

  if (!aUrl.isEmpty())
  {
    if (aUrl.protocol() == "mailto")
    {
      // popup on a mailto URL
      menu->insertItem(i18n("Send To..."), this,
                       SLOT(slotMailtoCompose()));
      if ( mMsgCurrent ) {
        menu->insertItem(i18n("Send Reply To..."), this,
                         SLOT(slotMailtoReply()));
        menu->insertItem(i18n("Forward To..."), this,
                         SLOT(slotMailtoForward()));
        menu->insertSeparator();
      }
      menu->insertItem(i18n("Add to Addressbook"), this,
		       SLOT(slotMailtoAddAddrBook()));
      menu->insertItem(i18n("Open in Addressbook..."), this,
		       SLOT(slotMailtoOpenAddrBook()));
      menu->insertItem(i18n("Copy to Clipboard"), this,
		       SLOT(slotUrlCopy()));
    }
    else
    {
      // popup on a not-mailto URL
      menu->insertItem(i18n("Open URL..."), this,
		       SLOT(slotUrlOpen()));
      menu->insertItem(i18n("Save Link As..."), this,
                       SLOT(slotUrlSave()));
      menu->insertItem(i18n("Copy to Clipboard"), this,
		       SLOT(slotUrlCopy()));
    }
  }
  else
  {
    // popup somewhere else (i.e., not a URL) on the message

    if (!mHeaders->currentMsg()) // no messages
    {
         delete menu;
         return;
     }

     bool out_folder = kernel->folderIsDraftOrOutbox(mFolder);
     if ( out_folder ) {
         editAction->plug(menu);
     }
     else {
         replyAction->plug(menu);
         replyAllAction->plug(menu);
	 action("message_forward")->plug(menu);
         bounceAction->plug(menu);
     }
     menu->insertSeparator();
     if ( !out_folder ) {
         filterMenu->plug( menu );
         statusMenu->plug( menu );
	 threadStatusMenu->plug( menu );
     }

     copyActionMenu->plug( menu );
     moveActionMenu->plug( menu );

     menu->insertSeparator();
     toggleFixFontAction->plug(menu);
     viewSourceAction->plug(menu);

     menu->insertSeparator();
     printAction->plug(menu);
     saveAsAction->plug(menu);
     menu->insertSeparator();
     trashAction->plug(menu);
     deleteAction->plug(menu);
  }
  menu->exec(aPoint, 0);
  delete menu;
}
---END---

Anyone here who calls this "cleanup"? ;-)

-- 
Mutig warf sich die kleine Überwachungskamera zwischen Täter und Opfer!
                                        --Rena Tangens / FoeBuD e.V.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: signature
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20020905/cabaf47b/attachment.sig>


More information about the kde-core-devel mailing list