Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt WebKit
  4. Cookies
Forum Updated to NodeBB v4.3 + New Features

Cookies

Scheduled Pinned Locked Moved Qt WebKit
24 Posts 3 Posters 15.8k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • 1 Offline
    1 Offline
    1blah111111
    wrote on last edited by
    #15

    chetankjain, any chance you could attempt to explain what danilocesar tried (and failed) to explain? and btw i'm definately making a lot of progress towards learning qt :D the designer interface is straight foward, the scripting, not so much :D and if you want something to happen on the loading of a form you put it under the section where the form is created right?

    1 Reply Last reply
    0
    • 1 Offline
      1 Offline
      1blah111111
      wrote on last edited by
      #16

      and i'm now stuck as to where to go from here towards enabling cookies across all the frames, here is the code i have currently.

      @Widget::Widget(QWidget *parent) :
      QWidget(parent),
      ui(new Ui::Widget)
      {
      ui->setupUi(this);
      QWebSettings::globalSettings()->setAttribute(QWebSettings::PluginsEnabled, true);
      ui->Advnt_Main->stop();
      ui->Ally_Main->stop();
      ui->Equipt_Main->stop();
      ui->Log_Main->stop();
      ui->Magic_Main->stop();
      ui->Msgs_Main->stop();
      ui->Nav_Main->stop();
      ui->News_Main->stop();
      ui->Prgrs_Main->stop();
      ui->Profile_Main->stop();
      ui->Quest_Main->stop();
      ui->Story_Main->stop();
      void QNetworkAccessManager::setCookieJar ( QNetworkCookieJar * cookieJar );
      }
      Widget::~Widget()
      {
      delete ui;
      }

      void Widget::on_actionLoggedin_triggered()
      {
      ui->Login_Main->load( QUrl("http://magicduel.com/") );
      ui->Advnt_Main->load( QUrl("http://magicduel.com/dlg/dlg.adventurelog.php") );
      ui->Ally_Main->load( QUrl("http://magicduel.com/ifrm/ifrm.alliance.php") );
      ui->Equipt_Main->load( QUrl("http://magicduel.com/ifrm/ifrm.weapons.php") );
      ui->Log_Main->load( QUrl("http://magicduel.com/dlg/dlg.battlelog.php") );
      ui->Magic_Main->load( QUrl("http://magicduel.com/ifrm/ifrm.magicpage.php") );
      ui->Msgs_Main->load( QUrl("http://magicduel.com/dlg/dlg.messagelist.php?categ=") );
      ui->Nav_Main->load( QUrl("http://magicduel.com/layout.php") );
      ui->News_Main->load( QUrl("http://magicduel.com/dlg/dlg.changelog.php") );
      ui->Prgrs_Main->load( QUrl("http://magicduel.com/dlg/dlg.todaysprofile.php") );
      ui->Profile_Main->load( QUrl("http://magicduel.com/ifrm/ifrm.profile.php") );
      ui->Quest_Main->load( QUrl("http://magicduel.com/pages/info.rpcquestlist.php") );
      ui->Story_Main->load( QUrl("http://magicduel.com/ifrm/ifrm.quest.php&rs=cof") );
      }
      @

      1 Reply Last reply
      0
      • 1 Offline
        1 Offline
        1blah111111
        wrote on last edited by
        #17

        i keep getting

        error: invalid use of qualified-name ‘QNetworkAccessManager::setCookieJar’

        when i try to compile it.

        1 Reply Last reply
        0
        • 1 Offline
          1 Offline
          1blah111111
          wrote on last edited by
          #18

          ok, i've gotten it to create the cookie jar, i just need to figure out how to refer them all to the same cookie jar. here is what i have so far:

          @Widget::Widget(QWidget *parent) :
          QWidget(parent),
          ui(new Ui::Widget)
          {
          ui->setupUi(this);
          QWebSettings::globalSettings()->setAttribute(QWebSettings::PluginsEnabled, true);
          ui->Advnt_Main->stop();
          ui->Ally_Main->stop();
          ui->Equipt_Main->stop();
          ui->Log_Main->stop();
          ui->Magic_Main->stop();
          ui->Msgs_Main->stop();
          ui->Nav_Main->stop();
          ui->News_Main->stop();
          ui->Prgrs_Main->stop();
          ui->Profile_Main->stop();
          ui->Quest_Main->stop();
          ui->Story_Main->stop();
          ui->Login_Main->page()->networkAccessManager()->setCookieJar ( new QNetworkCookieJar() );
          ui->Advnt_Main->page()->networkAccessManager()->setCookieJar ( new QNetworkCookieJar() );
          ui->Ally_Main->page()->networkAccessManager()->setCookieJar ( new QNetworkCookieJar() );
          ui->Equipt_Main->page()->networkAccessManager()->setCookieJar ( new QNetworkCookieJar() );
          ui->Log_Main->page()->networkAccessManager()->setCookieJar ( new QNetworkCookieJar() );
          ui->Magic_Main->page()->networkAccessManager()->setCookieJar ( new QNetworkCookieJar() );
          ui->Msgs_Main->page()->networkAccessManager()->setCookieJar ( new QNetworkCookieJar() );
          ui->Nav_Main->page()->networkAccessManager()->setCookieJar ( new QNetworkCookieJar() );
          ui->News_Main->page()->networkAccessManager()->setCookieJar ( new QNetworkCookieJar() );
          ui->Prgrs_Main->page()->networkAccessManager()->setCookieJar ( new QNetworkCookieJar() );
          ui->Profile_Main->page()->networkAccessManager()->setCookieJar ( new QNetworkCookieJar() );
          ui->Quest_Main->page()->networkAccessManager()->setCookieJar ( new QNetworkCookieJar() );
          ui->Story_Main->page()->networkAccessManager()->setCookieJar ( new QNetworkCookieJar() );
          }
          Widget::~Widget()
          {
          delete ui;
          }

          void Widget::on_actionLoggedin_triggered()
          {
          ui->Login_Main->load( QUrl("http://magicduel.com/") );
          ui->Advnt_Main->load( QUrl("http://magicduel.com/dlg/dlg.adventurelog.php") );
          ui->Ally_Main->load( QUrl("http://magicduel.com/ifrm/ifrm.alliance.php") );
          ui->Equipt_Main->load( QUrl("http://magicduel.com/ifrm/ifrm.weapons.php") );
          ui->Log_Main->load( QUrl("http://magicduel.com/dlg/dlg.battlelog.php") );
          ui->Magic_Main->load( QUrl("http://magicduel.com/ifrm/ifrm.magicpage.php") );
          ui->Msgs_Main->load( QUrl("http://magicduel.com/dlg/dlg.messagelist.php?categ=") );
          ui->Nav_Main->load( QUrl("http://magicduel.com/layout.php") );
          ui->News_Main->load( QUrl("http://magicduel.com/dlg/dlg.changelog.php") );
          ui->Prgrs_Main->load( QUrl("http://magicduel.com/dlg/dlg.todaysprofile.php") );
          ui->Profile_Main->load( QUrl("http://magicduel.com/ifrm/ifrm.profile.php") );
          ui->Quest_Main->load( QUrl("http://magicduel.com/pages/info.rpcquestlist.php") );
          ui->Story_Main->load( QUrl("http://magicduel.com/ifrm/ifrm.quest.php") );
          }

          void QNetworkCookieJar ( QObject *)
          {

          }

          QNetworkCookieJar::~QNetworkCookieJar ()
          {

          }
          @

          1 Reply Last reply
          0
          • B Offline
            B Offline
            benjamin.poulain
            wrote on last edited by
            #19

            You need to create one instance of QNetworkAccessManager, set your cookiejar on it, and call QWebPage::setNetworkAccessManager() on every page with the instance of QNetworkAccessManager you created.

            I suggest you to have a look at a book of C++. You make some basic mistakes like when you called the following directly in your code:
            @void QNetworkAccessManager::setCookieJar ( QNetworkCookieJar * cookieJar );@

            I think coding with Qt will be much easier when you understand C++ better.

            1 Reply Last reply
            0
            • B Offline
              B Offline
              benjamin.poulain
              wrote on last edited by
              #20

              bq. I suggest you to have a look at a book of C++.

              Thinking about it, reading the code of Arora can also help you a lot. This use case is a basic use case in the code base of Arora.

              1 Reply Last reply
              0
              • 1 Offline
                1 Offline
                1blah111111
                wrote on last edited by
                #21

                any chance you could show me a bit of sample code that i would have to use to get it working? It's the last problem I have before i can get my program actually off the ground, because currently it would take just over an hour to login to all of the frames, because the site forces a 5 minute delay between logins to the same account, meaning you have to wait between logging in in each frame, and that's just not very practical.

                1 Reply Last reply
                0
                • 1 Offline
                  1 Offline
                  1blah111111
                  wrote on last edited by
                  #22

                  And i do have the source code of Arora, the problem is, it dynamically creates the webview's where-as i already have all of the web views. The sourcecode of arora has actually been useful though, as it has helped me solve some of the problems i've encountered.

                  1 Reply Last reply
                  0
                  • B Offline
                    B Offline
                    benjamin.poulain
                    wrote on last edited by
                    #23

                    Quick and dirty?

                    @
                    QNetworkAccessManager *const networkAccessManager = new QNetworkAccessManager(this);
                    ui->Login_Main->page()->setNetworkAccessManager(networkAccessManager);
                    ui->Advnt_Main->page()->setNetworkAccessManager(networkAccessManager);
                    @

                    etc.

                    [edit: added code tag / chetankjain]

                    1 Reply Last reply
                    0
                    • 1 Offline
                      1 Offline
                      1blah111111
                      wrote on last edited by
                      #24

                      THANK YOU!!!!!!!!!!!!!!!!!!!!!!!

                      1 Reply Last reply
                      0

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved